protected function loadFiles($directory, $namespace, $callback) {
        foreach (new \DirectoryIterator($directory) as $file) {
            $filename = $file->getBasename();
            if ($file->isFile() && substr($filename, -4) == '.php') {
                $name  = substr($filename, 0, -4);
                $class = $namespace . $name;
                call_user_func($callback, $name, $class);
            }
        }
    }
protected function loadFiles($directory, $namespace, $callback) {
        foreach (new \DirectoryIterator($directory) as $file) {
            $filename = $file->getBasename();
            if ($file->isFile() && substr($filename, -4) == '.php') {
                $name  = substr($filename, 0, -4);
                $class = $namespace . $name;
                call_user_func($callback, $name, $class);
            }
        }
    }
protected function loadFiles ( $ directory , $ namespace , $ callback ) { foreach ( new \ DirectoryIterator ( $ directory ) as $ file ) { $ filename = $ file -> getBasename ( ) ; if ( $ file -> isFile ( ) && substr ( $ filename , - 4 ) == '.php' ) { $ name = substr ( $ filename , 0 , - 4 ) ; $ class = $ namespace . $ name ; call_user_func ( $ callback , $ name , $ class ) ; } } }
Load a set of classes from a directory into the factory

@param string $directory  The directory to search for classes in
@param string $namespace  The namespace prefix for any found classes
@param callable $callback The callback with which to register the class

@return void
Load a set of classes from a directory into the factory