<commit_before><?php
require_once 'Zend/Loader.php';
class Vps_Loader extends Zend_Loader
{
    public function classExists($class)
    {
        $filename = str_replace('_', DIRECTORY_SEPARATOR, $class) . '.php';

        foreach (explode(PATH_SEPARATOR, get_include_path()) as $dir) {
            $filespec = rtrim($dir, '\\/') . DIRECTORY_SEPARATOR . $filename;
            if (is_file($filespec)) {
                return class_exists($class);
            }
        }
        return false;
    }

    public static function registerAutoload()
    {
        require_once 'Vps/Benchmark.php';
        if (Vps_Benchmark::isEnabled()) {
            $class = 'Vps_Loader_Benchmark';
            require_once 'Vps/Loader/Benchmark.php';
        } else {
            //für performance
            $class = 'Vps_Loader';
        }
        $autoloader = Zend_Loader_Autoloader::getInstance();
        $autoloader->setDefaultAutoloader(array($class, 'loadClass'));
        $autoloader->setFallbackAutoloader(true);
    }

    public static function loadClass($class)
    {
        if ($class == 'TCPDF') {
            require_once 'tcpdf.php';
        } else {
            $file = str_replace('_', DIRECTORY_SEPARATOR, $class) . '.php';
            try {
                include_once $file;
            } catch (Exception $e) {
                if ($fp = @fopen($file, 'r', true)) {
                    //wenns die datei gibt, fehler weiterschmeissen
                    //(file_exists akzeptiert leider keinen use_include_path parameter)
                    fclose($fp);
                    throw $e;
                }
                //wenns die datei nicht gibt, keinen fehler schmeissen
                //ist notwendig für class_exists das false zurück gibt
            }
        }
    }
}<commit_msg>Zend_Loader ist langsam und wir verwenden eigentlich kein feature davon - also nicht verwenden<commit_after><?php
class Vps_Loader
{
    public function classExists($class)
    {
        $filename = str_replace('_', DIRECTORY_SEPARATOR, $class) . '.php';

        foreach (explode(PATH_SEPARATOR, get_include_path()) as $dir) {
            $filespec = rtrim($dir, '\\/') . DIRECTORY_SEPARATOR . $filename;
            if (is_file($filespec)) {
                return class_exists($class);
            }
        }
        return false;
    }

    public static function registerAutoload()
    {
        require_once 'Vps/Benchmark.php';
        if (Vps_Benchmark::isEnabled()) {
            $class = 'Vps_Loader_Benchmark';
            require_once 'Vps/Loader/Benchmark.php';
        } else {
            //für performance
            $class = 'Vps_Loader';
        }
        spl_autoload_register(array($class, 'loadClass'));
    }

    public static function loadClass($class)
    {
        if ($class == 'TCPDF') {
            require_once 'tcpdf.php';
        } else {
            $file = str_replace('_', DIRECTORY_SEPARATOR, $class) . '.php';
            try {
                include_once $file;
            } catch (Exception $e) {
                if ($fp = @fopen($file, 'r', true)) {
                    //wenns die datei gibt, fehler weiterschmeissen
                    //(file_exists akzeptiert leider keinen use_include_path parameter)
                    fclose($fp);
                    throw $e;
                }
                //wenns die datei nicht gibt, keinen fehler schmeissen
                //ist notwendig für class_exists das false zurück gibt
            }
        }
    }
}
{'fraction_non_alphanumeric': 0.11136493432324386, 'fraction_numerical': 0.0, 'mean_word_length': 1.7345823575331771, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '54419', 'n_tokens_mistral': 1052, 'n_tokens_neox': 1016, 'n_words': 223}