<commit_before><?php
/**
 * This file is part of the Everon framework.
 *
 * (c) <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
namespace Everon\Mvc;

use Everon\Dependency;
use Everon\Domain;
use Everon\Exception;
use Everon\Helper;
use Everon\Http;
use Everon\Module;
use Everon\View;

/**
 * @method Http\Interfaces\Response getResponse()
 * @method Module\Interfaces\Mvc getModule()
 */
abstract class Controller extends \Everon\Controller implements Interfaces\Controller
{
    use Dependency\Injection\Factory;
    use View\Dependency\Injection\ViewManager;
    use Domain\Dependency\Injection\DomainManager;
    use Http\Dependency\Injection\HttpSession;

    use Helper\Arrays;
    

    /**
     * @param $action
     * @param $result
     */
    protected function prepareResponse($action, $result)
    {
        if ($result) {
            $this->executeView($this->getView(), $action);
        }

        $ActionTemplate = $this->getView()->getTemplate($action, $this->getView()->getData());
        if ($ActionTemplate === null) { //apparently no template was used, fall back to string
            $ActionTemplate = $this->getView()->getContainer();
        }

        $Theme = $this->getViewManager()->getCurrentTheme($this->getName());

        $data = $this->arrayMergeDefault($Theme->getData(), $ActionTemplate->getData());
        $ActionTemplate->setData($data);
        
        $Theme->set('body', $ActionTemplate);
        $this->executeView($Theme, $action);
        
        //$data = $this->arrayMergeDefault($Theme->getData(), $ActionTemplate->getData());
        //$Theme->setData($data);
        $this->getView()->setContainer($Theme->getContainer());
        $this->getViewManager()->compileView($action, $this->getView());

        $content = (string) $this->getView()->getContainer();
        $this->getResponse()->setData($content);
    }

    protected function response()
    {
        echo $this->getResponse()->toHtml();
    }
    
    /**
     * @param $action<commit_msg>cleanups<commit_after><?php
/**
 * This file is part of the Everon framework.
 *
 * (c) <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
namespace Everon\Mvc;

use Everon\Dependency;
use Everon\Domain;
use Everon\Exception;
use Everon\Helper;
use Everon\Http;
use Everon\Module;
use Everon\View;

/**
 * @method Http\Interfaces\Response getResponse()
 * @method Module\Interfaces\Mvc getModule()
 */
abstract class Controller extends \Everon\Controller implements Interfaces\Controller
{
    use Dependency\Injection\Factory;
    use View\Dependency\Injection\ViewManager;
    use Domain\Dependency\Injection\DomainManager;
    use Http\Dependency\Injection\HttpSession;

    use Helper\Arrays;
    

    /**
     * @param $action
     * @param $result
     */
    protected function prepareResponse($action, $result)
    {
        if ($result) {
            $this->executeView($this->getView(), $action);
        }

        $Theme = $this->getViewManager()->getCurrentTheme($this->getName());
        $data = $this->arrayMergeDefault($Theme->getData(), $this->getView()->getData());

        $ActionTemplate = $this->getView()->getTemplate($action, $data);
        if ($ActionTemplate === null) { //apparently no template was used, fall back to string
            $ActionTemplate = $this->getView()->getContainer();
        }

        $Theme->set('body', $ActionTemplate);
        $this->executeView($Theme, $action);
        
        //$data = $this->arrayMergeDefault($Theme->getData(), $ActionTemplate->getData());
        //$Theme->setData($data);
        $this->getView()->setContainer($Theme->getContainer());
        $this->getViewManager()->compileView($action, $this->getView());

        $content = (string) $this->getView()->getContainer();
        $this->getResponse()->setData($content);
    }

    protected function response()
    {
        echo $this->getResponse()->toHtml();
    }
    
    /**
     * @param $action
{'fraction_non_alphanumeric': 0.15742526518804242, 'fraction_numerical': 0.0, 'mean_word_length': 3.11199207135778, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 73, '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': '494244', 'n_tokens_mistral': 1162, 'n_tokens_neox': 1160, 'n_words': 252}