public function getAllCommands(string $namespace = ''): array
	{
		$this->initCommands();

		if ($namespace === '')
		{
			$commands = $this->commands;

			if (!$this->commandLoader)
			{
				return $commands;
			}

			foreach ($this->commandLoader->getNames() as $name)
			{
				if (!isset($commands[$name]))
				{
					$commands[$name] = $this->getCommand($name);
				}
			}

			return $commands;
		}

		$commands = [];

		foreach ($this->commands as $name => $command)
		{
			if ($namespace === $this->extractNamespace($name, substr_count($namespace, ':') + 1))
			{
				$commands[$name] = $command;
			}
		}

		if ($this->commandLoader)
		{
			foreach ($this->commandLoader->getNames() as $name)
			{
				if (!isset($commands[$name]) && $namespace === $this->extractNamespace($name, substr_count($namespace, ':') + 1))
				{
					$commands[$name] = $this->getCommand($name);
				}
			}
		}

		return $commands;
	}
public function getAllCommands(string $namespace = ''): array
	{
		$this->initCommands();

		if ($namespace === '')
		{
			$commands = $this->commands;

			if (!$this->commandLoader)
			{
				return $commands;
			}

			foreach ($this->commandLoader->getNames() as $name)
			{
				if (!isset($commands[$name]))
				{
					$commands[$name] = $this->getCommand($name);
				}
			}

			return $commands;
		}

		$commands = [];

		foreach ($this->commands as $name => $command)
		{
			if ($namespace === $this->extractNamespace($name, substr_count($namespace, ':') + 1))
			{
				$commands[$name] = $command;
			}
		}

		if ($this->commandLoader)
		{
			foreach ($this->commandLoader->getNames() as $name)
			{
				if (!isset($commands[$name]) && $namespace === $this->extractNamespace($name, substr_count($namespace, ':') + 1))
				{
					$commands[$name] = $this->getCommand($name);
				}
			}
		}

		return $commands;
	}
public function getAllCommands ( string $ namespace = '' ) : array { $ this -> initCommands ( ) ; if ( $ namespace === '' ) { $ commands = $ this -> commands ; if ( ! $ this -> commandLoader ) { return $ commands ; } foreach ( $ this -> commandLoader -> getNames ( ) as $ name ) { if ( ! isset ( $ commands [ $ name ] ) ) { $ commands [ $ name ] = $ this -> getCommand ( $ name ) ; } } return $ commands ; } $ commands = [ ] ; foreach ( $ this -> commands as $ name => $ command ) { if ( $ namespace === $ this -> extractNamespace ( $ name , substr_count ( $ namespace , ':' ) + 1 ) ) { $ commands [ $ name ] = $ command ; } } if ( $ this -> commandLoader ) { foreach ( $ this -> commandLoader -> getNames ( ) as $ name ) { if ( ! isset ( $ commands [ $ name ] ) && $ namespace === $ this -> extractNamespace ( $ name , substr_count ( $ namespace , ':' ) + 1 ) ) { $ commands [ $ name ] = $ this -> getCommand ( $ name ) ; } } } return $ commands ; }
Gets all commands, including those available through a command loader, optionally filtered on a command namespace.

@param   string  $namespace  An optional command namespace to filter by.

@return  AbstractCommand[]

@since   __DEPLOY_VERSION__
Gets all commands including those available through a command loader optionally filtered on a command namespace .