<commit_before><?php
/**
 * CloudLib :: Lightweight MVC PHP Framework
 *
 * @author      <NAME> <<EMAIL>>
 * @copyright   Copyright (c) 2011 <NAME> <<EMAIL>>
 * @license     MIT License (http://www.opensource.org/licenses/mit-license.php)
 * @package     cloudlib
 */

/**
 * The core class.
 *
 * <short description>
 *
 * @package     cloudlib
 * @subpackage  cloudlib.lib.classes.core
 * @copyright   Copyright (c) 2011 <NAME> <<EMAIL>>
 * @license     MIT License (http://www.opensource.org/licenses/mit-license.php)
 */
class Core
{
    /**
     * Current version of cloudlib
     *
     * @access  public
     */
    const VERSION = '0.3.11.0';

    /**
     * Array of current activated modules
     *
     * @access  private
     * @var     array
     */
    private static $helpers = array();

    /**
     * Constructor
     *
     * @access  public
     * @return  void
     */
    public function __construct() {}

    /**
     * Main
     *
     * @access  public
     * @return  void
     */
    public static function main()
    {
        date_default_timezone_set(Config::general('timezone'));
        setlocale(LC_ALL, Config::general('locale'));

        Request::removeMagicQuotes();

        $dispatcher = Dispatcher::factory()->dispatch();
    }

    /**
     * Autoloader
     *
     * @access  public
     * @param   string  $class
     * @return  string
     */
    public static function autoload($class)
    {
        switch(true)
        {
            case preg_match('/Controller$/', $class):
                $directory = CTRLS;
                break;
            case preg_match('/Model$/', $class):
                $directory = MODELS;
                break;
            default:
                $directory = HELPERS;
                break;
        }

        if(!file_exists($file = $directory . $class . EXT))
        {
            if(!file_exists($file = CORE . $class . EXT))
            {
                throw new CloudException('Unable to autolad: ' . $class);
            }
        }
        
        require $file;
    }

    /**
     * Loads a helper
     *
     * @access  public
     * @param   string  $helper
     * @return  object
     */
    public static function loadHelper($helper)
    {
        if(!in_array($helper, self::$helpers))
        {
            self::$helpers[$helper] = $helper::factory();
        }

        return self::$helpers[$helper];
    }

    /**
     * Delete a directory and its contents
     *
     * @access  public
     * @param   string  $directory
     * @return  void
     */
    public static function deleteDir($directory)
    {
        if(!file_exists($directory))<commit_msg>removed the helpers array, objects are stored in the factory class<commit_after><?php
/**
 * CloudLib :: Lightweight MVC PHP Framework
 *
 * @author      <NAME> <<EMAIL>>
 * @copyright   Copyright (c) 2011 <NAME> <<EMAIL>>
 * @license     MIT License (http://www.opensource.org/licenses/mit-license.php)
 * @package     cloudlib
 */

/**
 * The core class.
 *
 * <short description>
 *
 * @package     cloudlib
 * @subpackage  cloudlib.lib.classes.core
 * @copyright   Copyright (c) 2011 <NAME> <<EMAIL>>
 * @license     MIT License (http://www.opensource.org/licenses/mit-license.php)
 */
class Core
{
    /**
     * Current version of cloudlib
     *
     * @access  public
     */
    const VERSION = '0.4.0';

    /**
     * Constructor
     *
     * @access  public
     * @return  void
     */
    public function __construct() {}

    /**
     * Main
     *
     * @access  public
     * @return  void
     */
    public static function main()
    {
        date_default_timezone_set(Config::general('timezone'));
        setlocale(LC_ALL, Config::general('locale'));

        Request::removeMagicQuotes();

        $dispatcher = Dispatcher::factory()->dispatch();
    }

    /**
     * Autoloader
     *
     * @access  public
     * @param   string  $class
     * @return  string
     */
    public static function autoload($class)
    {
        switch(true)
        {
            case preg_match('/Controller$/', $class):
                $directory = CTRLS;
                break;
            case preg_match('/Model$/', $class):
                $directory = MODELS;
                break;
            default:
                $directory = HELPERS;
                break;
        }

        if(!file_exists($file = $directory . $class . EXT))
        {
            if(!file_exists($file = CORE . $class . EXT))
            {
                throw new CloudException('Unable to autolad: ' . $class);
            }
        }
        
        require $file;
    }

    /**
     * Delete a directory and its contents
     *
     * @access  public
     * @param   string  $directory
     * @return  void
     */
    public static function deleteDir($directory)
    {
        if(!file_exists($directory))
{'fraction_non_alphanumeric': 0.1313193588162762, 'fraction_numerical': 0.004932182490752158, 'mean_word_length': 1.6919247787610618, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 1, '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': '2327907', 'n_tokens_mistral': 1460, 'n_tokens_neox': 1407, 'n_words': 316}