<commit_before><?php

class CustomLoader
{
    private $loader;

    public function __construct($loader)
    {
        $this->loader = $loader;
    }

    public function loadClass($class)
    {
        $result = $this->loader->loadClass($class);
        if ($result && method_exists($class, '_init')) {
            call_user_func(array($class, '_init'));
        }

        return $result;
    }
}

$loader = require VENDORPATH.'autoload.php';
$loader->unregister();
spl_autoload_register(array(new CustomLoader($loader), 'loadClass'));<commit_msg>Added check for class exists (no traits, interfaces)<commit_after><?php

class CustomLoader
{
    private $loader;

    public function __construct($loader)
    {
        $this->loader = $loader;
    }

    public function loadClass($class)
    {
        $result = $this->loader->loadClass($class);
        if ($result && class_exists($class, false) && method_exists($class, '_init')) {
            call_user_func(array($class, '_init'));
        }

        return $result;
    }
}

$loader = require VENDORPATH.'autoload.php';
$loader->unregister();
spl_autoload_register(array(new CustomLoader($loader), 'loadClass'));
{'fraction_non_alphanumeric': 0.15128205128205127, 'fraction_numerical': 0.0, 'mean_word_length': 3.2581818181818183, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, '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': '7003692', 'n_tokens_mistral': 351, 'n_tokens_neox': 348, 'n_words': 68}