<commit_before><?php

/**
 *
 * DebugrLoad.php: Autoloader for PHPDebugr
 * 
 * It uses the 'spl_autoload_register' function
 * to make it easier to implement the lib
 * 
 * 
 * @package PHPDebugr
 * @subpackage main
 * @author <NAME> <EMAIL>
 * @copyright 2013 <NAME> 
 * @license http://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0
 * @link https://github.com/nikoutel/PHPDebugr 
 * 
 * 
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. 
 * 
 */

/**
 * Autoload method for PHPDebugr
 *  
 * @param string $className
 */
function PHPDebugr_autoload($className) {
    $className = ltrim($className, '\\');
    $fileName  = '';
    $namespace = '';
    if ($lastNsPos = strrpos($className, '\\')) {
        $namespace = substr($className, 0, $lastNsPos);
        $className = substr($className, $lastNsPos + 1);
        $fileName  = str_replace('\\', DIRECTORY_SEPARATOR, $namespace) . DIRECTORY_SEPARATOR;
    }
    $fileName .= str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php';

    require $fileName;
}

spl_autoload_register('PHPDebugr_autoload');
?><commit_msg>checks if files exist before require() in namespave compatible autoloader<commit_after><?php

/**
 *
 * DebugrLoad.php: Autoloader for PHPDebugr
 * 
 * It uses the 'spl_autoload_register' function
 * to make it easier to implement the lib
 * 
 * 
 * @package PHPDebugr
 * @subpackage main
 * @author <NAME> <EMAIL>
 * @copyright 2013 <NAME> 
 * @license http://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0
 * @link https://github.com/nikoutel/PHPDebugr 
 * 
 * 
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. 
 * 
 */

/**
 * Autoload method for PHPDebugr
 *  
 * @param string $className
 */
function PHPDebugr_autoload($className) { 

    $debugrPath = dirname(dirname(__FILE__));
    $className = ltrim($className, '\\');
    $fileName  = '';
    $namespace = '';
    if ($lastNsPos = strrpos($className, '\\')) {
        $namespace = substr($className, 0, $lastNsPos);
        $className = substr($className, $lastNsPos + 1);
        $fileName  = str_replace('\\', DIRECTORY_SEPARATOR, $namespace) . DIRECTORY_SEPARATOR;
    }
    $fileName .= str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php';
    $file = $debugrPath . DIRECTORY_SEPARATOR . $fileName;
    if (true === file_exists($file)) {
        require($file);
        return true;
    }
}

spl_autoload_register('PHPDebugr_autoload');
?>
{'fraction_non_alphanumeric': 0.14296214626975376, 'fraction_numerical': 0.010290334435869165, 'mean_word_length': 3.320634920634921, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 2, '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': '3895336', 'n_tokens_mistral': 931, 'n_tokens_neox': 911, 'n_words': 235}