<commit_before><?php
/**
 * =============================================================================
 * Copyright (c) 2013, <NAME>
 * All rights reserved.
 *
 * This file is part of Conductor and is licensed by the Copyright holder under
 * the 3-clause BSD License.  The full text of the license can be found in the
 * LICENSE.txt file included in the root directory of this distribution or at
 * the link below.
 * =============================================================================
 *
 * @license http://www.opensource.org/licenses/bsd-license.php
 */
namespace zpt\cdt\rest;

use \zpt\rest\ExceptionHandler;
use \zpt\rest\Request;
use \zpt\rest\Response;
use \zpt\rest\RestExceptionHandler;
use \zpt\cdt\L10N;
use \Exception;

/**
 * Replacement for the default RestExceptionHandler which will detect messages
 * that are localization codes and replace them with their localized message.
 *
 * @author <NAME> <<EMAIL>>
 */
class LocalizedRestExceptionHandler implements ExceptionHandler
{

    private $defaultHandler;
    
    /**
     * Create a new LocalizedRestExceptionHandler.  An instance of the
     * default exception handler is required to build the actual response.
     *
     * @param RestExceptionHandler $defaultHandler
     */
    public function __construct(RestExceptionHandler $defaultHandler)
    {
        $this->defaultHandler = $defaultHandler;
    }

    /**
     * Handle a RestException.
     */<commit_msg>[minor] CS: Remove leading \ from use statements<commit_after><?php
/**
 * =============================================================================
 * Copyright (c) 2013, <NAME>
 * All rights reserved.
 *
 * This file is part of Conductor and is licensed by the Copyright holder under
 * the 3-clause BSD License.  The full text of the license can be found in the
 * LICENSE.txt file included in the root directory of this distribution or at
 * the link below.
 * =============================================================================
 *
 * @license http://www.opensource.org/licenses/bsd-license.php
 */
namespace zpt\cdt\rest;

use zpt\rest\ExceptionHandler;
use zpt\rest\Request;
use zpt\rest\Response;
use zpt\rest\RestExceptionHandler;
use zpt\cdt\L10N;
use Exception;

/**
 * Replacement for the default RestExceptionHandler which will detect messages
 * that are localization codes and replace them with their localized message.
 *
 * @author <NAME> <<EMAIL>>
 */
class LocalizedRestExceptionHandler implements ExceptionHandler
{

    private $defaultHandler;
    
    /**
     * Create a new LocalizedRestExceptionHandler.  An instance of the
     * default exception handler is required to build the actual response.
     *
     * @param RestExceptionHandler $defaultHandler
     */
    public function __construct(RestExceptionHandler $defaultHandler)
    {
        $this->defaultHandler = $defaultHandler;
    }

    /**
     * Handle a RestException.
     */
{'fraction_non_alphanumeric': 0.1839863713798978, 'fraction_numerical': 0.004770017035775128, 'mean_word_length': 3.885191347753744, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '2547048', 'n_tokens_mistral': 764, 'n_tokens_neox': 723, 'n_words': 260}