<commit_before><?php
/**
 * Slim - a micro PHP 5 framework
 *
 * @author      <NAME> <<EMAIL>>
 * @copyright   2011 <NAME>
 * @link        http://www.slimframework.com
 * @license     http://www.slimframework.com/license
 * @version     1.6.4
 * @package     Slim
 *
 * MIT LICENSE
 *
 * Permission is hereby granted, free of charge, to any person obtaining
 * a copy of this software and associated documentation files (the
 * "Software"), to deal in the Software without restriction, including
 * without limitation the rights to use, copy, modify, merge, publish,
 * distribute, sublicense, and/or sell copies of the Software, and to
 * permit persons to whom the Software is furnished to do so, subject to
 * the following conditions:
 *
 * The above copyright notice and this permission notice shall be
 * included in all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */

/**
 * Slim
 * @package Slim
 * @author  <NAME>
 * @since   1.0.0
 */
class Slim {
    /**
     * @const string
     */
    const VERSION = '1.6.0';

    /**
     * @var array[Slim]
     */
    protected static $apps = array();

    /**
     * @var string
     */
    protected $name;

    /**
     * @var array
     */
    protected $environment;

    /**
     * @var Slim_Http_Request
     */
    protected $request;

    /**
     * @var Slim_Http_Response
     */
    protected $response;

    /**
     * @var Slim_Router
     */
    protected $router;

    /**
     * @var Slim_View
     */
    protected $view;

    /**
     * @var array
     */
    protected $settings;

    /**
     * @var string
     */
    protected $mode;

    /**
     * @var array
     */
    protected $middleware;

    /**
     * @var array
     */
    protected $hooks = array(
        'slim.before' => array(array()),
        'slim.before.router' => array(array()),
        'slim.before.dispatch' => array(array()),
        'slim.after.dispatch' => array(array()),
        'slim.after.router' => array(array()),
        'slim.after' => array(array())
    );

    /**
     * Slim autoloader
     *
     * Lazy-loads class files when a given class is first referenced.
     * Class files must exist in the same directory as this file and be named
     * the same as its class definition (excluding the dot and extension).
     *
     * @return void
     */
    public static function autoload( $class ) {
        if ( strpos($class, 'Slim') !== 0 ) {
            return;
        }
        $file = dirname(__FILE__) . '/' . str_replace('_', DIRECTORY_SEPARATOR, substr($class,5)) . '.php';
        if ( file_exists($file) ) {
            require $file;
        }
    }

    /***** INSTANTIATION *****/

    /**
     * Constructor
     * @param   array   $userSettings   Key-Value array of application settings
     * @return  void
     */
    public function __construct( $userSettings = array() ) {
        //Setup Slim application
        $this->settings = array_merge(self::getDefaultSettings(), $userSettings);
        if ( $this->config('install_autoloader') ) {
            spl_autoload_register(array('Slim', 'autoload'));
        }
        $this->environment = Slim_Environment::getInstance();
        $this->request = new Slim_Http_Request($this->environment);
        $this->response = new Slim_Http_Response();
        $this->router = new Slim_Router($this->request, $this->response);
        $this->middleware = array($this);
        $this->add(new Slim_Middleware_Flash());
        $this->add(new Slim_Middleware_MethodOverride());

        //Determine application mode
        $this->getMode();

        //Setup view
        $this->view($this->config('view'));

        //Make default if first instance
        if ( is_null(self::getInstance()) ) {
            $this->setName('default');
        }

        //Set default logger that writes to stderr (may be overridden with middleware)
        $logWriter = $this->config('log.writer');
        if ( !$logWriter ) {
            $logWriter = new Slim_LogWriter($this->environment['slim.errors']);
        }
        $log = new Slim_Log($logWriter);<commit_msg>Revert autoloader<commit_after><?php
/**
 * Slim - a micro PHP 5 framework
 *
 * @author      <NAME> <<EMAIL>>
 * @copyright   2011 <NAME>
 * @link        http://www.slimframework.com
 * @license     http://www.slimframework.com/license
 * @version     1.6.4
 * @package     Slim
 *
 * MIT LICENSE
 *
 * Permission is hereby granted, free of charge, to any person obtaining
 * a copy of this software and associated documentation files (the
 * "Software"), to deal in the Software without restriction, including
 * without limitation the rights to use, copy, modify, merge, publish,
 * distribute, sublicense, and/or sell copies of the Software, and to
 * permit persons to whom the Software is furnished to do so, subject to
 * the following conditions:
 *
 * The above copyright notice and this permission notice shall be
 * included in all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */

// Comment out this line if you are using an alternative autoloader (e.g. Composer)
Slim::registerAutoloader();

/**
 * Slim
 * @package Slim
 * @author  <NAME>
 * @since   1.0.0
 */
class Slim {
    /**
     * @const string
     */
    const VERSION = '1.6.0';

    /**
     * @var array[Slim]
     */
    protected static $apps = array();

    /**
     * @var string
     */
    protected $name;

    /**
     * @var array
     */
    protected $environment;

    /**
     * @var Slim_Http_Request
     */
    protected $request;

    /**
     * @var Slim_Http_Response
     */
    protected $response;

    /**
     * @var Slim_Router
     */
    protected $router;

    /**
     * @var Slim_View
     */
    protected $view;

    /**
     * @var array
     */
    protected $settings;

    /**
     * @var string
     */
    protected $mode;

    /**
     * @var array
     */
    protected $middleware;

    /**
     * @var array
     */
    protected $hooks = array(
        'slim.before' => array(array()),
        'slim.before.router' => array(array()),
        'slim.before.dispatch' => array(array()),
        'slim.after.dispatch' => array(array()),
        'slim.after.router' => array(array()),
        'slim.after' => array(array())
    );

    /**
     * Slim autoloader
     *
     * Lazy-loads class files when a given class is first referenced.
     * Class files must exist in the same directory as this file and be named
     * the same as its class definition (excluding the dot and extension).
     *
     * @return void
     */
    public static function autoload( $class ) {
        if ( strpos($class, 'Slim') !== 0 ) {
            return;
        }
        $file = dirname(__FILE__) . '/' . str_replace('_', DIRECTORY_SEPARATOR, substr($class,5)) . '.php';
        if ( file_exists($file) ) {
            require $file;
        }
    }

    /**
     * Register Slim's built-in autoloader
     */
    public static function registerAutoloader() {
        spl_autoload_register(array('Slim', 'autoload'));
    }

    /***** INSTANTIATION *****/

    /**
     * Constructor
     * @param   array   $userSettings   Key-Value array of application settings
     * @return  void
     */
    public function __construct( $userSettings = array() ) {
        //Setup Slim application
        $this->settings = array_merge(self::getDefaultSettings(), $userSettings);
        $this->environment = Slim_Environment::getInstance();
        $this->request = new Slim_Http_Request($this->environment);
        $this->response = new Slim_Http_Response();
        $this->router = new Slim_Router($this->request, $this->response);
        $this->middleware = array($this);
        $this->add(new Slim_Middleware_Flash());
        $this->add(new Slim_Middleware_MethodOverride());

        //Determine application mode
        $this->getMode();

        //Setup view
        $this->view($this->config('view'));

        //Make default if first instance
        if ( is_null(self::getInstance()) ) {
            $this->setName('default');
        }

        //Set default logger that writes to stderr (may be overridden with middleware)
        $logWriter = $this->config('log.writer');
        if ( !$logWriter ) {
            $logWriter = new Slim_LogWriter($this->environment['slim.errors']);
        }
        $log = new Slim_Log($logWriter);
{'fraction_non_alphanumeric': 0.12690901269090127, 'fraction_numerical': 0.0034416003441600346, 'mean_word_length': 2.3546176046176046, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 60, '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': '6364446', 'n_tokens_mistral': 2722, 'n_tokens_neox': 2627, 'n_words': 818}