public function addCommandsFromDir($dir, $namespace = '', $includeFiles = false)
    {
        foreach (new DirectoryIterator($dir) as $file) {
            $filename = $file->getFilename();
            if ($file->isDir() || substr($filename, 0, 1) === '.' || strlen($filename) <= 11 
                || strtolower(substr($filename, -11)) !== 'command.php') {
                    continue;
            }
            if ($includeFiles) {
                include $file->getPathname();
            }
            $className = trim($namespace . '\\' . substr($filename, 0, -4), '\\');
            $this->addCommand($className);
        }
        return $this;
    }
public function addCommandsFromDir($dir, $namespace = '', $includeFiles = false)
    {
        foreach (new DirectoryIterator($dir) as $file) {
            $filename = $file->getFilename();
            if ($file->isDir() || substr($filename, 0, 1) === '.' || strlen($filename) <= 11 
                || strtolower(substr($filename, -11)) !== 'command.php') {
                    continue;
            }
            if ($includeFiles) {
                include $file->getPathname();
            }
            $className = trim($namespace . '\\' . substr($filename, 0, -4), '\\');
            $this->addCommand($className);
        }
        return $this;
    }
public function addCommandsFromDir ( $ dir , $ namespace = '' , $ includeFiles = false ) { foreach ( new DirectoryIterator ( $ dir ) as $ file ) { $ filename = $ file -> getFilename ( ) ; if ( $ file -> isDir ( ) || substr ( $ filename , 0 , 1 ) === '.' || strlen ( $ filename ) <= 11 || strtolower ( substr ( $ filename , - 11 ) ) !== 'command.php' ) { continue ; } if ( $ includeFiles ) { include $ file -> getPathname ( ) ; } $ className = trim ( $ namespace . '\\' . substr ( $ filename , 0 , - 4 ) , '\\' ) ; $ this -> addCommand ( $ className ) ; } return $ this ; }
Registers commands from a directory

@param string $dir
@param string $namespace
@param bool $includeFiles
@return Console
Registers commands from a directory