public static function routeCommand($command = 'help')
	{
		// Aliases take precedence, so parse for them first
		if ($aliases = Config::get('aliases'))
		{
			if (array_key_exists($command, $aliases))
			{
				if (strpos($aliases->$command, '::') !== false)
				{
					$bits      = explode('::', $aliases->$command);
					$command   = $bits[0];
					$aliasTask = $bits[1];
				}
				else
				{
					$command = $aliases->$command;
				}
			}
		}

		foreach (self::$commandNamespaces as $namespace)
		{
			// Check if we're targeting a namespaced command
			$bits = [];
			if (strpos($command, ':'))
			{
				$bits = explode(':', $command);
			}
			else
			{
				$bits[] = $command;
			}

			$bits = array_map('ucfirst', $bits);

			// Replace any inset placeholders
			for ($i = 0; $i < count($bits); $i++)
			{
				$loc = $i + 1;
				if (strpos($namespace, "{\$$loc}"))
				{
					$namespace = str_replace("{\$$loc}", $bits[$i], $namespace);
					unset($bits[$i]);
				}
			}

			// Add any remaining bits to the end of the command namespace
			if (count($bits) > 0)
			{
				$namespace .= '\\' . implode('\\', $bits);
			}

			// Check for existence
			if (class_exists($namespace))
			{
				$class = $namespace;
				break;
			}
		}

		if (!isset($class))
		{
			throw new UnsupportedCommandException("Unknown command: {$command}.");
		}

		return $class;
	}
public static function routeCommand($command = 'help')
	{
		// Aliases take precedence, so parse for them first
		if ($aliases = Config::get('aliases'))
		{
			if (array_key_exists($command, $aliases))
			{
				if (strpos($aliases->$command, '::') !== false)
				{
					$bits      = explode('::', $aliases->$command);
					$command   = $bits[0];
					$aliasTask = $bits[1];
				}
				else
				{
					$command = $aliases->$command;
				}
			}
		}

		foreach (self::$commandNamespaces as $namespace)
		{
			// Check if we're targeting a namespaced command
			$bits = [];
			if (strpos($command, ':'))
			{
				$bits = explode(':', $command);
			}
			else
			{
				$bits[] = $command;
			}

			$bits = array_map('ucfirst', $bits);

			// Replace any inset placeholders
			for ($i = 0; $i < count($bits); $i++)
			{
				$loc = $i + 1;
				if (strpos($namespace, "{\$$loc}"))
				{
					$namespace = str_replace("{\$$loc}", $bits[$i], $namespace);
					unset($bits[$i]);
				}
			}

			// Add any remaining bits to the end of the command namespace
			if (count($bits) > 0)
			{
				$namespace .= '\\' . implode('\\', $bits);
			}

			// Check for existence
			if (class_exists($namespace))
			{
				$class = $namespace;
				break;
			}
		}

		if (!isset($class))
		{
			throw new UnsupportedCommandException("Unknown command: {$command}.");
		}

		return $class;
	}
public static function routeCommand ( $ command = 'help' ) { // Aliases take precedence, so parse for them first if ( $ aliases = Config :: get ( 'aliases' ) ) { if ( array_key_exists ( $ command , $ aliases ) ) { if ( strpos ( $ aliases -> $ command , '::' ) !== false ) { $ bits = explode ( '::' , $ aliases -> $ command ) ; $ command = $ bits [ 0 ] ; $ aliasTask = $ bits [ 1 ] ; } else { $ command = $ aliases -> $ command ; } } } foreach ( self :: $ commandNamespaces as $ namespace ) { // Check if we're targeting a namespaced command $ bits = [ ] ; if ( strpos ( $ command , ':' ) ) { $ bits = explode ( ':' , $ command ) ; } else { $ bits [ ] = $ command ; } $ bits = array_map ( 'ucfirst' , $ bits ) ; // Replace any inset placeholders for ( $ i = 0 ; $ i < count ( $ bits ) ; $ i ++ ) { $ loc = $ i + 1 ; if ( strpos ( $ namespace , "{\$$loc}" ) ) { $ namespace = str_replace ( "{\$$loc}" , $ bits [ $ i ] , $ namespace ) ; unset ( $ bits [ $ i ] ) ; } } // Add any remaining bits to the end of the command namespace if ( count ( $ bits ) > 0 ) { $ namespace .= '\\' . implode ( '\\' , $ bits ) ; } // Check for existence if ( class_exists ( $ namespace ) ) { $ class = $ namespace ; break ; } } if ( ! isset ( $ class ) ) { throw new UnsupportedCommandException ( "Unknown command: {$command}." ) ; } return $ class ; }
Routes command to the proper file based on the input given

@param   string  $command  The command to route
@return  void
Routes command to the proper file based on the input given