@param $name

@return BaseCommand

@since  1.1.0

@author Eddilbert Macharia (http://eddmash.com) <edd.cowan@gmail.com>
760060
public function fetchCommand($name)
    {
        $name = ucfirst($name);

        $file = null;
        $packageName = null;

        foreach ($this->defaultCommandsPaths as $package => $path) {
            $file_handler = new FileHandler($path);

            $file = $file_handler->getFile($name);
            if (false !== $file) {
                $packageName = $package;

                break;
            }
        }

        if (false === $file) {
            $this->error(
                sprintf(
                    'Unknown command: ` %1$s`. Does the file exists `%2$s/%1$s.php` ?'.PHP_EOL,
                    $name,
                    $this->defaultCommandsPaths
                )
            );
            $message = $this->ansiFormat(sprintf('php %s.php help', $this->managerName), Console::FG_YELLOW);
            $this->normal(sprintf('Type %s for usage.'.PHP_EOL, $message));
        }

        // commands are in the commands namespace
        /** @var $className BaseCommand */
        $className = ClassHelper::getFormatNamespace($packageName).'Console\Command\\'.$name;

        return new $className();
    }
394725
protected function getArg ($name)
	{
		if (isset ($this->request['json']->$name))
		{
			return $this->getJSONArg ($name);
		}
		else
		{
			return parent::getArg ($name);
		}
	}
987890
protected function buildClass($name)
    {
        $stub = parent::buildClass($name);

        $modelName = $this->getModelClass($name);

        $this->replaceModelNamespace($stub, $modelName)
             ->replaceModelClass($stub, $modelName)
             ->replaceBaseRepositoryNamespace($stub, $this->base)
             ->replaceBaseRepositoryClass($stub, $this->base);

        return $stub;
    }
918657
public static function normalize($name)
	{
		$name = (string) $name;

		if (!static::isValid($name))
		{
			throw new InvalidArgumentException("Invalid parameter name '" . $name . "'");
		}

		return $name;
	}
1101627
private function getRealSiteName($name)
    {
        if (! is_null($name)) {
            return $name;
        }

        if (is_string($link = $this->getLinkNameByCurrentDir())) {
            return $link;
        }

        return basename(getcwd());
    }
588710
public function find($name) {
        $allCommands = array_keys($this->commands);

        $expr = preg_replace_callback('{([^:]+|)}', function ($matches) {
            return preg_quote($matches[1]) . '[^:]*';
        }, $name);

        $commands = preg_grep('{^' . $expr . '}', $allCommands);

        if (empty($commands) || count(preg_grep('{^' . $expr . '$}', $commands)) < 1) {
            if (false !== $pos = strrpos($name, ':')) {
                $this->findNamespace(substr($name, 0, $pos));
            }

            $message = sprintf('Command "%s" is not defined.', $name);

            if ($alternatives = $this->findAlternatives($name, $allCommands)) {
                if (1 == count($alternatives)) {
                    $message .= "\n\nDid you mean this?\n    ";
                }
                else {
                    $message .= "\n\nDid you mean one of these?\n    ";
                }
                $message .= implode("\n    ", $alternatives);
            }

            throw new \InvalidArgumentException($message);
        }

        if (count($commands) > 1) {
            $commandList = $this->commands;

            $commands = array_filter($commands, function ($nameOrAlias) use ($commandList, $commands) {
                $commandName = $commandList[$nameOrAlias]->getName();

                return $commandName === $nameOrAlias || !in_array($commandName, $commands);
            });
        }

        $exact = in_array($name, $commands, true);
        if (count($commands) > 1 && !$exact) {
            $suggestions = $this->getAbbreviationSuggestions(array_values($commands));

            throw new \InvalidArgumentException(sprintf('Command "%s" is ambiguous (%s).', $name, $suggestions));
        }

        return $this->get($exact ? $name : reset($commands));
    }
515854
public function createServiceWithName(
        ServiceLocatorInterface $serviceLocator,
        $name,
        $requestedName
    ) {
        return new BaseController(
            $serviceLocator->getServiceLocator()->get('Config'),
            $requestedName,
            $serviceLocator
        );
    }
564209
public function get_args($name){
    if ( $this->checked ){
      $cmd_name = str_replace('_', '-', $name);
      return isset($this->commands[$cmd_name], $this->commands[$cmd_name]['args']) ? $this->commands[$cmd_name]['args'] : [];
    }
  }
490203
public function getCommand($name, array $args = array()) {
    /*if($name != 'oauth') {
		  $this->checkAuth();
    }*/

    $command = parent::getCommand($name, $args);
    $this->command_history[] = $command;
		return $command;
	}
448676
public static function serviceClassname($name)
    {
        $services = static::services();

        if (!isset($services[$name])) {
            throw new \InvalidArgumentException(
                sprintf('The provided service %s does not exist.', $name)
            );
        }

        return $services[$name];
    }
1093229
public function buildCommand(string $name, array $definition): CommandInterface
    {
        $command = new Command($name);
        $command->setExecutable($definition[static::CONFIG_COMMAND]);

        $this->setExcluded($command, $definition);
        $this->setGroups($command, $definition);
        $this->setEnv($command, $definition);
        $this->setIsStoreAware($command, $definition);
        $this->setStores($command, $definition);
        $this->addCommandConditions($command, $definition);
        $this->setPreCommand($command, $definition);
        $this->setPostCommand($command, $definition);
        $this->setBreakOnFailure($command, $definition);
        $this->setTimeout($command, $definition);

        return $command;
    }
634290
function getCommands($name, $unique = false)
    {
        if (!isset($this->commands[$name])){
            $this->commands[$name] = [];
        }
        if ($unique){
            $keys = [];
            $result = [];
            foreach ($this->commands[$name] as $com){
                $key = serialize($com);
                if (!isset($keys[$key])){
                    $result[] = $com;
                    $keys[$key] = true;
                }
            }
            unset($keys);
            return $result;
        }
        return $this->commands[$name];
    }
60054
public function getRequiredArg(string $name)
    {
        if ('' !== $this->get($name, '')) {
            return $this->args[$name];
        }

        throw new \InvalidArgumentException(sprintf('The argument %s is required', $name));
    }
107793
private function getOperator(string $name)
    {
        if (!isset($this->operator[$name])) {
            $class                 = '\\SebastianFeldmann\\Git\\Operator\\' . $name;
            $this->operator[$name] = new $class($this->runner, $this);
        }
        return $this->operator[$name];
    }
651565
private function build(string $name): BuildCommand
    {
        /*
         * We prepare the application for a build, moving it to production. Then,
         * after compile all the code to a single file, we move the built file
         * to the builds folder with the correct permissions.
         */
        $this->prepare()
            ->compile($name)
            ->clear();

        $this->output->writeln(
            sprintf('    Compiled successfully: <fg=green>%s</>', $this->app->buildsPath($name))
        );

        return $this;
    }
961767
public function nestedName($name)
    {
        if (!is_string($name)) {
            throw new InvalidArgumentException('nestedName name must string.');
        }
        $nestedTypes = $this->nestedTypes($name);

        if ($nestedTypes === false) {
            return $name;
        }
        return mb_substr($name, 0, mb_strlen($name) - mb_strlen($nestedTypes[count($nestedTypes) - 1]));
    }
683823
public function setName($name) {
        if ($this->frozen) throw new RuntimeException('Configuration of "'.get_class($this).'" is frozen');

        $this->validateName($name);
        $this->name = $name;

        if ($name === '') {
            $this->aliases = [];                                    // a default command cannot have aliases
        }
        else {
            $this->aliases = array_diff($this->aliases, [$name]);   // remove overlapping aliases
        }
        return $this;
    }