<commit_before><?php
/**
 * Nooku Framework - http://www.nooku.org
 *
 * @copyright	Copyright (C) 2011 - 2013 <NAME> and Timble CVBA. (http://www.timble.net)
 * @license		GNU GPLv3 <http://www.gnu.org/licenses/gpl.html>
 * @link		git://git.assembla.com/nooku-framework.git for the canonical source repository
 */

namespace Nooku\Component\Application;

use Nooku\Library;

/**
 * Error Controller
 *   
 * @author  <NAME> <http://nooku.assembla.com/profile/johanjanssens>
 * @package Nooku\Component\Application
 */
class ControllerError extends Library\ControllerView
{
    /**
     * Render an exception
     *
     * @throws \InvalidArgumentException If the action parameter is not an instance of Library\Exception
     * @param Library\ControllerContextInterface $context	A controller context object
     */
    protected function _actionRender(Library\ControllerContextInterface $context)
    {
        //Check an exception was passed<commit_msg>Fix. Always render json exceptions.<commit_after><?php
/**
 * Nooku Framework - http://www.nooku.org
 *
 * @copyright	Copyright (C) 2011 - 2013 <NAME> and Timble CVBA. (http://www.timble.net)
 * @license		GNU GPLv3 <http://www.gnu.org/licenses/gpl.html>
 * @link		git://git.assembla.com/nooku-framework.git for the canonical source repository
 */

namespace Nooku\Component\Application;

use Nooku\Library;

/**
 * Error Controller
 *   
 * @author  <NAME> <http://nooku.assembla.com/profile/johanjanssens>
 * @package Nooku\Component\Application
 */
class ControllerError extends Library\ControllerView
{
    /**
     * Initializes the default configuration for the object
     *
     * Called from {@link __construct()} as a first step of object instantiation.
     *
     * @param   Library\ObjectConfig $config Configuration options
     * @return void
     */
    protected function _initialize(Library\ObjectConfig $config)
    {
        $config->append(array(
            'formats' => array('json'),
        ));

        parent::_initialize($config);
    }

    /**
     * Render an exception
     *
     * @throws \InvalidArgumentException If the action parameter is not an instance of Library\Exception
     * @param Library\ControllerContextInterface $context	A controller context object
     */
    protected function _actionRender(Library\ControllerContextInterface $context)
    {
        //Check an exception was passed
{'fraction_non_alphanumeric': 0.11236897274633123, 'fraction_numerical': 0.007547169811320755, 'mean_word_length': 3.238010657193606, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 6, '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': '4657880', 'n_tokens_mistral': 704, 'n_tokens_neox': 680, 'n_words': 178}