private function preload(): void
    {
        $iterator = new \RecursiveIteratorIterator(
            new \RecursiveDirectoryIterator(
                __DIR__
            )
        );

        /** @var \SplFileInfo $file */
        foreach ($iterator as $file) {
            if ($file->isFile() && $file->getExtension() === 'php') {
                require_once $file->getRealPath();
            }
        }

        $definedClasses = get_declared_classes();
        /** @var string $definedClass */
        foreach ($definedClasses as $definedClass) {
            try {
                $reflection = new \ReflectionClass($definedClass);
                if ($reflection->implementsInterface(PreloadInterface::class)) {
                    $callback = [$definedClass, 'preload'];
                    assert(is_callable($callback));
                    call_user_func($callback, $this->composer);
                }
            } catch (\ReflectionException $e) {
                continue;
            }
        }
    }
private function preload(): void
    {
        $iterator = new \RecursiveIteratorIterator(
            new \RecursiveDirectoryIterator(
                __DIR__
            )
        );

        /** @var \SplFileInfo $file */
        foreach ($iterator as $file) {
            if ($file->isFile() && $file->getExtension() === 'php') {
                require_once $file->getRealPath();
            }
        }

        $definedClasses = get_declared_classes();
        /** @var string $definedClass */
        foreach ($definedClasses as $definedClass) {
            try {
                $reflection = new \ReflectionClass($definedClass);
                if ($reflection->implementsInterface(PreloadInterface::class)) {
                    $callback = [$definedClass, 'preload'];
                    assert(is_callable($callback));
                    call_user_func($callback, $this->composer);
                }
            } catch (\ReflectionException $e) {
                continue;
            }
        }
    }
private function preload ( ) : void { $ iterator = new \ RecursiveIteratorIterator ( new \ RecursiveDirectoryIterator ( __DIR__ ) ) ; /** @var \SplFileInfo $file */ foreach ( $ iterator as $ file ) { if ( $ file -> isFile ( ) && $ file -> getExtension ( ) === 'php' ) { require_once $ file -> getRealPath ( ) ; } } $ definedClasses = get_declared_classes ( ) ; /** @var string $definedClass */ foreach ( $ definedClasses as $ definedClass ) { try { $ reflection = new \ ReflectionClass ( $ definedClass ) ; if ( $ reflection -> implementsInterface ( PreloadInterface :: class ) ) { $ callback = [ $ definedClass , 'preload' ] ; assert ( is_callable ( $ callback ) ) ; call_user_func ( $ callback , $ this -> composer ) ; } } catch ( \ ReflectionException $ e ) { continue ; } } }
Preloads all classes
Preloads all classes