Build a new command argument from an array.

@param string $name
@param array $params

@return Argument
15600
public static function createFromArray($name, array $params)
    {
        $argument = new Argument($name);
        $params   = self::getSettableArgumentParams($params);

        foreach ($params as $key => $value) {
            $method = 'set' . ucwords($key);
            $argument->{$method}($value);
        }

        return $argument;
    }
610118
public function getCommand($name, array $args = [])
    {
        if (!$this->description->hasOperation($name)) {
            $name = ucfirst($name);
            if (!$this->description->hasOperation($name)) {
                throw new \InvalidArgumentException(
                    "No operation found named {$name}"
                );
            }
        }

        // Merge in default command options
        $args += $this->getConfig('defaults');

        return parent::getCommand($name, $args);
    }
1368184
public function create($name, $params = []) {
		if($this->isClassName($name)) {
			$className = $name;
		} else {
			$className = $this->genClassName($name);
		}
		$result = [];
		$params = ArrayHelper::toArray($params);
		if(!empty($params) && ArrayHelper::isIndexed($params)) {
			foreach($params as $item) {
				$result[] = $this->createClass($className, $item);
			}
		} else {
			$result = $this->createClass($className, $params);
		}
		return $result;
	}
1022440
protected function buildClass($name)
	{
		$stub = parent::buildClass($name);

		$stub = str_replace(
			'{{command}}', class_basename($this->option('command')), $stub
		);

		$stub = str_replace(
			'{{fullCommand}}', $this->option('command'), $stub
		);

		return $stub;
	}
563235
private function commands($params)
    {
        if (is_array($params)) {
            $param = '';
            $i = 0;
            $arrCount = count($params);

            foreach ($params as $key => $value) {
                $param .= $value;

                $comma = ($i < $arrCount - 1) ? ',' : '';

                $param .= $comma;

                $i++;
            }
        }

        if (is_string($params)) {
            $param = $params;
        }

        return $param;
    }
770469
protected static function _compileCommand($command,array $params){
        $s = $w = [];
        foreach ($params as $p) {
            if ($p instanceof static) {
              $s[] = '$('.$p->getShellCommand().')';
            } else if (is_array($p)) foreach ($p as $key => $value) {
                if(is_numeric($key)){
                  $w[] = '--'.$value;
                } else {
                  if(is_bool($value)){
                     if($value) $w[] = '--'.$key;
                  } else {
                    $w[] = '--'.$key.'='.escapeshellarg($value);
                  }
                }
            } else {
              $s[] = $p;
            }
        }
        return trim(
            '/usr/bin/env '.$command.' '.implode(' ',array_merge($w,$s))
        );
    }
565579
public function addCommand(
        string $name,
        string $description,
        array $operands = null,
        array $options = null,
        array $parameters = null
    ): ShellBuilder {
        $definition = new Definition();
        foreach ($operands ?? [] as $operand) {
            $definition->addOperand(
                new Operand($operand['name'])
            );
        }

        foreach ($options ?? [] as $option) {
            $definition->addOption(
                new Option(
                    $option['name'],
                    $option['description'],
                    $option['short'] ?? null,
                    $option['long'] ?? null,
                    $option['flag'] ?? null,
                    $option['multiple'] ?? null
                )
            );
        }

        $this->commands[] = new Command(
            $name,
            $description,
            $definition,
            $parameters
        );

        return $this;
    }
382017
public function render(string $name, $params = []) : string
    {
        $params = $this->normalizeParams($params);
        return $this->template->make($name, $params)->render();
    }
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'] : [];
    }
  }
681231
public function call($command, array $params = [])
    {
        $params['command'] = $command;
        $this->lastOutput = new BufferedOutput();

        return $this->find($command)->run(new ArrayInput($params), $this->lastOutput);
    }
849658
public function make($name, array $params = array(), $force = false)
    {
        if (isset($this->_ioc[$name])) {

            // If a singleton instance exists, return it
            if ($this->_ioc[$name]['instance'] && !$force)
                return $this->_ioc[$name]['instance'];

            // Include an instance of this object as the final argument
            $params[] = $this;

            // Call the stored container
            $result = call_user_func_array($this->_ioc[$name]['closure'], $params);

            // If this is supposed to be a singleton, store it
            if ($this->_ioc[$name]['singleton'])
                $this->_ioc[$name]['instance'] = $result;

            return $result;
        }

        return null;
    }
99514
protected function format($name, array $args = null)
    {
        $result = ['name' => $name];
        if ($args !== null) {
            $result['args'] = $args;
        }

        return $result;
    }
109782
private function makeService($name, array $args = [])
    {
        if (!isset($this->services[$name]) || $args) {
            $apiClient = $this->sdk->createClient($name, $args);
            $model = $this->loadModel($name, $apiClient->getApi()->getApiVersion());
            $resourceClient = new ResourceClient($apiClient, $model);
            $this->services[$name] = new Resource($resourceClient, 'service', [], []);
        }

        return $this->services[$name];
    }
457371
public function execute($name, array $params = [], array $headers = [])
    {
        $executor = new Executor($this);

        return $executor->run($name, $params, $headers);
    }
35449
public function generate($name, $params = []) {
		$url = '';
		$path = $this->generatePath($name, $params);

		if ($path) {
			if (isset($_SERVER['HTTP_X_FORWARDED_PROTO'])
				&& $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https'
			) {
				$scheme = 'https';
			} else {
				$scheme = 'http';
			}
			$url = $scheme . '://' . $_SERVER['HTTP_HOST'] . $path;
		}

		return $url;
	}
199821
private function execute($name, array $arguments)
    {
        return $this->functions[$name]->call($this->mapper, $this->connection, $this->strategies, $this->environment, $arguments, []);
    }
470055
public static function executeCommand($commandName, array $commandParameters) {
        if (isset(self::$commands[$commandName])) {
            $commandAction = self::$commands[$commandName];
        }
        else {
            $commandsBaseNamespace = get_property("cli.commands_base_namespace");
            if (!empty($commandsBaseNamespace)) {
                $commandAction = $commandsBaseNamespace;
                $commandTokens = explode(".", $commandName);
                $commandTokensSize = sizeof($commandTokens);
                if ($commandTokensSize > 1) {
                    for ($i = 0; $i < $commandTokensSize - 1; $i++) {
                        $commandToken = $commandTokens[$i];
                        $commandAction .= '\\';
                        $commandAction .= str_replace(' ', '', ucwords(str_replace('_', ' ', $commandToken)));
                    }
                }
                $commandAction .= '\\';
                $commandAction .= str_replace(' ', '', ucwords(str_replace('_', ' ', $commandTokens[$commandTokensSize - 1])));
                $commandAction .= get_property("cli.commands_suffix", "Command");
            }
            else {
                throw new CommandNotFoundException("Command \"$commandName\" not found !!");
            }
        }

        $result = null;
        if (is_string($commandAction) && class_exists($commandAction) && is_subclass_of($commandAction, Command::class)) {
            if (!isset(self::$commandInstances[$commandAction])) {
                self::$commandInstances[$commandAction] = new $commandAction;
            }
            self::$commandInstances[$commandAction]->handle($commandParameters);
        }
        else  {
            try {
                get_app()->execute($commandAction, $commandParameters);
            }
            catch (ActionNotFoundException $ex) {
                throw new CommandNotFoundException("Command \"$commandName\" not found !!. Command class \"$commandAction\" not found !! ", 0, $ex);
            }
        }
        return $result;
    }