<commit_before><?php
/**
 * @package		Koowa_Dispatcher
 * @subpackage  Request
 * @copyright	Copyright (C) 2007 - 2012 <NAME>. All rights reserved.
 * @license		GNU GPLv3 <http://www.gnu.org/licenses/gpl.html>
 * @link     	http://www.nooku.org
 */

namespace Nooku\Library;

/**
 * Abstract Dispatcher Request Class
 *
 * @author		<NAME> <<EMAIL>>
 * @package     Koowa_Dispatcher
 * @subpackage  Request
 */
class DispatcherRequest extends ControllerRequest implements DispatcherRequestInterface, ObjectInstantiable
{
    /**
     * The request cookies
     *
     * @var HttpMessageParameters
     */
    protected $_cookies;

    /**
     * The request files
     *
     * @var HttpMessageParameters
     */
    protected $_files;

    /**
     * Base url of the request.
     *
     * @var HttpUrl
     */
    protected $_base_url;

    /**
     * Base path of the request.
     *
     * @var string
     */
    protected $_base_path;

    /**
     * Root url of the request.
     *
     * @var HttpUrl
     */
    protected $_root;

    /**
     * Referrer of the request
     *
     * @var HttpUrl
     */
    protected $_referrer;

    /**
     * The format
     *
     * @var string
     */
    protected $_format;

    /**
     * The token
     *
     * @var string
     */
    protected $_token;

    /**
     * The supported languages
     *
     * @var array
     */
    protected $_languages;

    /**
     * The supported charsets
     *
     * @var array
     */
    protected $_charsets;

    /**
     * Mimetype to format mappings
     *
     * @var array
     */
    protected static $_formats;

    /**
     * Constructor
     *
     * @param ObjectConfig $config  An optional ObjectConfig object with configuration options
     * @return DispatcherRequest
     */
    public function __construct(ObjectConfig $config)
    {
        parent::__construct($config);

        //Set files parameters
        $this->setFiles($config->files);

        //Set cookie parameters
        $this->setCookies($config->cookies);

        //Set the base URL
        $this->setBaseUrl($config->base_url);

        //Set the base path
        $this->setBasePath($config->base_path);

        //Set the formats
        foreach(Config::unbox($config->formats) as $format => $mimetypes) {
            $this->addFormat($format, $mimetypes);
        }

        //Set document root for IIS
        if(!isset($_SERVER['DOCUMENT_ROOT']))
        {
            if(isset($_SERVER['SCRIPT_FILENAME'])) {
                $_SERVER['DOCUMENT_ROOT'] = str_replace( '\\', '/', substr($_SERVER['SCRIPT_FILENAME'], 0, 0 - strlen($_SERVER['PHP_SELF'])));
            }
<commit_msg>re #363 : Fixed typo<commit_after><?php
/**
 * @package		Koowa_Dispatcher
 * @subpackage  Request
 * @copyright	Copyright (C) 2007 - 2012 <NAME>. All rights reserved.
 * @license		GNU GPLv3 <http://www.gnu.org/licenses/gpl.html>
 * @link     	http://www.nooku.org
 */

namespace Nooku\Library;

/**
 * Abstract Dispatcher Request Class
 *
 * @author		<NAME> <<EMAIL>>
 * @package     Koowa_Dispatcher
 * @subpackage  Request
 */
class DispatcherRequest extends ControllerRequest implements DispatcherRequestInterface, ObjectInstantiable
{
    /**
     * The request cookies
     *
     * @var HttpMessageParameters
     */
    protected $_cookies;

    /**
     * The request files
     *
     * @var HttpMessageParameters
     */
    protected $_files;

    /**
     * Base url of the request.
     *
     * @var HttpUrl
     */
    protected $_base_url;

    /**
     * Base path of the request.
     *
     * @var string
     */
    protected $_base_path;

    /**
     * Root url of the request.
     *
     * @var HttpUrl
     */
    protected $_root;

    /**
     * Referrer of the request
     *
     * @var HttpUrl
     */
    protected $_referrer;

    /**
     * The format
     *
     * @var string
     */
    protected $_format;

    /**
     * The token
     *
     * @var string
     */
    protected $_token;

    /**
     * The supported languages
     *
     * @var array
     */
    protected $_languages;

    /**
     * The supported charsets
     *
     * @var array
     */
    protected $_charsets;

    /**
     * Mimetype to format mappings
     *
     * @var array
     */
    protected static $_formats;

    /**
     * Constructor
     *
     * @param ObjectConfig $config  An optional ObjectConfig object with configuration options
     * @return DispatcherRequest
     */
    public function __construct(ObjectConfig $config)
    {
        parent::__construct($config);

        //Set files parameters
        $this->setFiles($config->files);

        //Set cookie parameters
        $this->setCookies($config->cookies);

        //Set the base URL
        $this->setBaseUrl($config->base_url);

        //Set the base path
        $this->setBasePath($config->base_path);

        //Set the formats
        foreach(ObjectConfig::unbox($config->formats) as $format => $mimetypes) {
            $this->addFormat($format, $mimetypes);
        }

        //Set document root for IIS
        if(!isset($_SERVER['DOCUMENT_ROOT']))
        {
            if(isset($_SERVER['SCRIPT_FILENAME'])) {
                $_SERVER['DOCUMENT_ROOT'] = str_replace( '\\', '/', substr($_SERVER['SCRIPT_FILENAME'], 0, 0 - strlen($_SERVER['PHP_SELF'])));
            }

{'fraction_non_alphanumeric': 0.12769144354989703, 'fraction_numerical': 0.004680771391125257, 'mean_word_length': 1.943250688705234, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 35, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, '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': '1352371', 'n_tokens_mistral': 1643, 'n_tokens_neox': 1557, 'n_words': 367}