<commit_before><?php

namespace FzyCommon\Controller\Plugin;

use FzyCommon\Service\Update;
use Zend\Http\PhpEnvironment\Response;
use Zend\View\Model\JsonModel;

class UpdateResult extends Base
{
    public function __invoke(Update $updater)
    {
        $redirect = null;
        if ($updater->getValid()) {
            $this->flashMessenger()->addSuccessMessage($updater->getFormattedSuccessMessage());
            $redirect = $this->url()->fromRoute($updater->getSuccessRedirectRouteName(), $updater->getSuccessRedirectRouteParams(), $updater->getSuccessRedirectRouteOptions());
        } else {
	        // set error
	        /* @var $response \Zend\Http\PhpEnvironment\Response */
	        $response = $this->getService('Response');
	        $response->setStatusCode(Response::STATUS_CODE_400);
        }

        return array(
            'success' => $updater->getValid(),
            'messages' => $updater->getErrorMessages(),
            'models' => $updater->getEntitiesAsJson(),
            'redirect' => $redirect,
        );
    }

    /**
     * @return \Zend\Mvc\Controller\Plugin\FlashMessenger
     */
    protected function flashMessenger()
    {
        return $this->getService('ControllerPluginManager')
            ->get('flashmessenger');
    }

    /**
     * @return \Zend\Mvc\Controller\Plugin\Url
     */
    protected function url()
    {
        return $this->getService('ControllerPluginManager')
            ->get('url');
    }

}<commit_msg>Fixing namespace bug on update plugin.<commit_after><?php

namespace FzyCommon\Controller\Plugin;

use FzyCommon\Service\Update\Base as Update;
use Zend\Http\PhpEnvironment\Response;
use Zend\View\Model\JsonModel;

class UpdateResult extends Base
{
	public function __invoke(Update $updater)
	{
		$redirect = null;
		if ($updater->getValid()) {
			$this->flashMessenger()->addSuccessMessage($updater->getFormattedSuccessMessage());
			$redirect = $this->url()->fromRoute($updater->getSuccessRedirectRouteName(), $updater->getSuccessRedirectRouteParams(), $updater->getSuccessRedirectRouteOptions());
		} else {
			// set error
			/* @var $response \Zend\Http\PhpEnvironment\Response */
			$response = $this->getService('Response');
			$response->setStatusCode(Response::STATUS_CODE_400);
		}

		return array(
			'success' => $updater->getValid(),
			'messages' => $updater->getErrorMessages(),
			'models' => $updater->getEntitiesAsJson(),
			'redirect' => $redirect,
		);
	}

	/**
	 * @return \Zend\Mvc\Controller\Plugin\FlashMessenger
	 */
	protected function flashMessenger()
	{
		return $this->getService('ControllerPluginManager')
		            ->get('flashmessenger');
	}

	/**
	 * @return \Zend\Mvc\Controller\Plugin\Url
	 */
	protected function url()
	{
		return $this->getService('ControllerPluginManager')
		            ->get('url');
	}

}
{'fraction_non_alphanumeric': 0.15150442477876105, 'fraction_numerical': 0.0021238938053097347, 'mean_word_length': 3.314503816793893, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 47, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6202415', 'n_tokens_mistral': 871, 'n_tokens_neox': 837, 'n_words': 129}