private function getCommands($root = null, $dir = null)
	{
		$root = $root ?: __DIR__;
		$dir  = $dir  ?: '';
		$cur  = $root . ((!empty($dir)) ? DS . $dir : '');

		// Get files from command directory to use in list
		$files = array_diff(scandir($cur), array('..', '.'));

		foreach ($files as $file)
		{
			if (is_file($cur . DS . $file) && strpos($file, '.php') !== false)
			{
				$namespace  = str_replace($root . DS, '', $cur . DS . $file);
				$namespace  = str_replace(DS, '\\', $namespace);
				$class      = str_replace('.php', '', $namespace);

				// Make sure a valid class exists
				if (class_exists(__NAMESPACE__ . '\\' . $class))
				{
					$reflection = new \ReflectionClass(__NAMESPACE__ . '\\' . $class);

					// Make sure it implements the Command Interface
					if ($reflection->implementsInterface(__NAMESPACE__ . '\CommandInterface'))
					{
						$comment = $reflection->getDocComment();

						// Check for help ignore flag
						if (!preg_match('/@museIgnoreHelp/', $comment))
						{
							$this->_commands[] = $class;
						}
					}
				}
			}
			else if (is_dir($cur . DS . $file))
			{
				$this->getCommands($root, ((!empty($dir)) ? $dir . DS : '') . $file);
			}
		}
	}
private function getCommands($root = null, $dir = null)
	{
		$root = $root ?: __DIR__;
		$dir  = $dir  ?: '';
		$cur  = $root . ((!empty($dir)) ? DS . $dir : '');

		// Get files from command directory to use in list
		$files = array_diff(scandir($cur), array('..', '.'));

		foreach ($files as $file)
		{
			if (is_file($cur . DS . $file) && strpos($file, '.php') !== false)
			{
				$namespace  = str_replace($root . DS, '', $cur . DS . $file);
				$namespace  = str_replace(DS, '\\', $namespace);
				$class      = str_replace('.php', '', $namespace);

				// Make sure a valid class exists
				if (class_exists(__NAMESPACE__ . '\\' . $class))
				{
					$reflection = new \ReflectionClass(__NAMESPACE__ . '\\' . $class);

					// Make sure it implements the Command Interface
					if ($reflection->implementsInterface(__NAMESPACE__ . '\CommandInterface'))
					{
						$comment = $reflection->getDocComment();

						// Check for help ignore flag
						if (!preg_match('/@museIgnoreHelp/', $comment))
						{
							$this->_commands[] = $class;
						}
					}
				}
			}
			else if (is_dir($cur . DS . $file))
			{
				$this->getCommands($root, ((!empty($dir)) ? $dir . DS : '') . $file);
			}
		}
	}
private function getCommands ( $ root = null , $ dir = null ) { $ root = $ root ? : __DIR__ ; $ dir = $ dir ? : '' ; $ cur = $ root . ( ( ! empty ( $ dir ) ) ? DS . $ dir : '' ) ; // Get files from command directory to use in list $ files = array_diff ( scandir ( $ cur ) , array ( '..' , '.' ) ) ; foreach ( $ files as $ file ) { if ( is_file ( $ cur . DS . $ file ) && strpos ( $ file , '.php' ) !== false ) { $ namespace = str_replace ( $ root . DS , '' , $ cur . DS . $ file ) ; $ namespace = str_replace ( DS , '\\' , $ namespace ) ; $ class = str_replace ( '.php' , '' , $ namespace ) ; // Make sure a valid class exists if ( class_exists ( __NAMESPACE__ . '\\' . $ class ) ) { $ reflection = new \ ReflectionClass ( __NAMESPACE__ . '\\' . $ class ) ; // Make sure it implements the Command Interface if ( $ reflection -> implementsInterface ( __NAMESPACE__ . '\CommandInterface' ) ) { $ comment = $ reflection -> getDocComment ( ) ; // Check for help ignore flag if ( ! preg_match ( '/@museIgnoreHelp/' , $ comment ) ) { $ this -> _commands [ ] = $ class ; } } } } else if ( is_dir ( $ cur . DS . $ file ) ) { $ this -> getCommands ( $ root , ( ( ! empty ( $ dir ) ) ? $ dir . DS : '' ) . $ file ) ; } } }
Helper to get files in commands directy. This is used to generate a list of commands.

@param   string  $root  The root directory for commands
@param   string  $dir   The current directory to search for commands (relative to root)
@return  void
Helper to get files in commands directy . This is used to generate a list of commands .