NerdsAndCompany\Schematic\Console\CommandRunner::createCommand PHP Method

createCommand() public method

public createCommand ( string $name ) : CConsoleCommand
$name string command name (case-insensitive)
return CConsoleCommand The command object. Null if the name is invalid
    public function createCommand($name)
    {
        $name = StringHelper::toLowerCase($name);
        $command = null;
        if (isset($this->commands[$name])) {
            $command = $this->commands[$name];
        } else {
            $commands = array_change_key_case($this->commands);
            if (isset($commands[$name])) {
                $command = $commands[$name];
            }
        }
        if ($command !== null) {
            if (is_string($command)) {
                $className = 'NerdsAndCompany\\Schematic\\ConsoleCommands\\' . IOHelper::getFileName($command, false);
                return new $className($name, $this);
            } else {
                // an array configuration
                return Craft::createComponent($command, $name, $this);
            }
        } elseif ($name === 'help') {
            return new \CHelpCommand('help', $this);
        } else {
            return;
        }
    }
CommandRunner