private function awake(array $directories)
    {
        $includedFiles = array();

        self::$included = array_merge(self::$included, get_included_files());

        foreach ($directories as $directorie) {
            $iterator = new \RegexIterator(
                new \RecursiveIteratorIterator(
                    new \RecursiveDirectoryIterator($directorie, \FilesystemIterator::SKIP_DOTS),
                    \RecursiveIteratorIterator::LEAVES_ONLY
                ),
                '/^.+' . preg_quote('.php') . '$/i',
                \RecursiveRegexIterator::GET_MATCH
            );

            foreach ($iterator as $file) {
                $sourceFile = realpath($file[0]);

                if (in_array($sourceFile, self::$included) === false) {
                    require_once $sourceFile;
                }

                self::$included[] = $sourceFile;
                $includedFiles[]  = $sourceFile;
            }
        }

        $classes  = array();
        $declared = get_declared_classes();

        foreach ($declared as $className) {
            $rc         = new \ReflectionClass($className);
            $sourceFile = $rc->getFileName();

            if (in_array($sourceFile, $includedFiles) === true) {
                $classes[] = $className;
            }
        }

        return $classes;
    }
private function awake(array $directories)
    {
        $includedFiles = array();

        self::$included = array_merge(self::$included, get_included_files());

        foreach ($directories as $directorie) {
            $iterator = new \RegexIterator(
                new \RecursiveIteratorIterator(
                    new \RecursiveDirectoryIterator($directorie, \FilesystemIterator::SKIP_DOTS),
                    \RecursiveIteratorIterator::LEAVES_ONLY
                ),
                '/^.+' . preg_quote('.php') . '$/i',
                \RecursiveRegexIterator::GET_MATCH
            );

            foreach ($iterator as $file) {
                $sourceFile = realpath($file[0]);

                if (in_array($sourceFile, self::$included) === false) {
                    require_once $sourceFile;
                }

                self::$included[] = $sourceFile;
                $includedFiles[]  = $sourceFile;
            }
        }

        $classes  = array();
        $declared = get_declared_classes();

        foreach ($declared as $className) {
            $rc         = new \ReflectionClass($className);
            $sourceFile = $rc->getFileName();

            if (in_array($sourceFile, $includedFiles) === true) {
                $classes[] = $className;
            }
        }

        return $classes;
    }
private function awake ( array $ directories ) { $ includedFiles = array ( ) ; self :: $ included = array_merge ( self :: $ included , get_included_files ( ) ) ; foreach ( $ directories as $ directorie ) { $ iterator = new \ RegexIterator ( new \ RecursiveIteratorIterator ( new \ RecursiveDirectoryIterator ( $ directorie , \ FilesystemIterator :: SKIP_DOTS ) , \ RecursiveIteratorIterator :: LEAVES_ONLY ) , '/^.+' . preg_quote ( '.php' ) . '$/i' , \ RecursiveRegexIterator :: GET_MATCH ) ; foreach ( $ iterator as $ file ) { $ sourceFile = realpath ( $ file [ 0 ] ) ; if ( in_array ( $ sourceFile , self :: $ included ) === false ) { require_once $ sourceFile ; } self :: $ included [ ] = $ sourceFile ; $ includedFiles [ ] = $ sourceFile ; } } $ classes = array ( ) ; $ declared = get_declared_classes ( ) ; foreach ( $ declared as $ className ) { $ rc = new \ ReflectionClass ( $ className ) ; $ sourceFile = $ rc -> getFileName ( ) ; if ( in_array ( $ sourceFile , $ includedFiles ) === true ) { $ classes [ ] = $ className ; } } return $ classes ; }
Find classes on directory
@param  string[] $directories Target directory
@return array
Find classes on directory