Formats command aliases to show them in the command description.

@param Command $command

@return string
965199
private function getCommandAliasesText($command)
    {
        $text = '';
        $aliases = $command->getAliases();

        if ($aliases) {
            $text = '['.implode('|', $aliases).'] ';
        }

        return $text;
    }
137799
private function _generateCode($command)
	{
		$code = "<?php" . PHP_EOL .
				$command . PHP_EOL;

		if ($this->options['cleanup']) {
			$code .= "unlink('" . end($this->savedFiles) . "');";
		}

		return $code;
	}
768003
protected function _commandNew($command)
    {
        $name = $this->getController()->getIdentifier()->name;
        $labels = array();
        $labels[] = strtoupper('com-'.$this->getIdentifier()->package.'-toolbar-'.$name.'-new');
        $labels[] = 'NEW';
        $label = translate($labels);
        $url = 'option=com_'.$this->getIdentifier()->package.'&view='.$name.'&layout=add';

        $command->append(array('label' => $label))->href($url);
    }
525016
public function getCommandCallbacks($command = null)
    {
        $result = array();
        if($command)
        {
            if(isset($this->__command_callbacks[$command])) {
                $result = $this->__command_callbacks[$command];
            }
        }
        else $result = $this->__command_callbacks;

        return $result;
    }
862620
public function resolveCommand($command)
    {
        if ($fullPaths = $this->findWhere($command)) {
            $fullPaths = preg_split('/[\r\n]/', trim($fullPaths));
            $command = end($fullPaths);
        }

        return $command;
    }
682467
protected function formattedCommand($command)
    {
        $structure = [
            $this->getEnvVariable(),
            $this->executable,
            $this->getOptions(),
            $command
        ];

        return implode(' ', array_filter($structure));
    }
224583
private function formatOptions($options = [], $command = '')
    {
        $dumpOptions = [
            '-h | --help' => "display {$command}command help info",
            '--no-ansi' => "disable ansi output"
        ];

        count($options) > 0 && $dumpOptions = array_merge($dumpOptions, $options);

        $optionsDump = [];
        foreach ($dumpOptions as $name => $desc) {
            $name = Colour::colour($name, Colour::GREEN);
            $this->commandLength > strlen($name) || $this->commandLength = strlen($name) + 3;
            $optionsDump[$name] = $desc;
        }
        return $optionsDump;
    }
852770
protected function sendCommand(string $command) : string
    {
        try {
            $client = new Client;
            $client->addServer($this->config['sockets']['client']);
            $response = $client->sendCommand($command);
            $client->close();
            return $response;
        } catch (ClientException $e) {
            return 'error';
        }
    }
729015
public function inflect($command, $commandHandler)
    {
        $commandName = get_class($command);

        $start = strpos($commandName, '\\') !== false ? strrpos($commandName, '\\') + 1 : 0;
        $length = strpos($commandName, $this->suffix, -$this->suffixLength) !== false ? $this->suffixLength : null;

        return lcfirst($length ? substr($commandName, $start, -$length) : substr($commandName, $start));
    }
266051
private function formatCommand($command, $parameters)
    {
        $parameters = collect($parameters)->map(function ($parameter) {
            if (is_array($parameter)) {
                return collect($parameter)->map(function ($value, $key) {
                    return is_int($key) ? $value : "{$key} {$value}";
                })->implode(' ');
            }

            return $parameter;
        })->implode(' ');

        return "{$command} {$parameters}";
    }
270882
protected function getCommandConfig(Config $config, $command)
    {
        $string = '';
        if (isset($config[$command])) {
            /** @var Config $config */
            $config = $config[$command];
            if ($config->count() > 0) {
                $config = $config->toArray();
                /** @var array $config */
                $string .= $this->commands[$command] . PHP_EOL . '{' . PHP_EOL . "\t";
                $string .= $this->getValuesString($config, true);
                $string .= PHP_EOL . '}' . PHP_EOL;
            }
        }
        return $string;
    }
914343
public function profileCommand($command) {
		$tasks = $this->Task->find('all', array(
			'conditions' => array(
				'command' => $command,
				'status' => array(TaskType::STOPPED, TaskType::FINISHED),
				'runtime >' => 0
			),
			'fields' => array('runtime', 'id', 'started', 'stopped', 'created', 'waittime'),
			'limit' => Configure::read('Task.profilerLimit'),
			'order' => array(
				'id' => 'DESC'
			)
		));

		if (!$tasks) {
			return null;
		}

		$statistics = array_map(function($item) {
			$endDate = new DateTime($item['stopped']);
			$startDate = new DateTime($item['started']);
			$createdDate = new DateTime($item['created']);
			$item['runtimeHuman'] = $startDate->diff($endDate)->format(Configure::read('Task.dateDiffFormat'));
			$item['waittimeHuman'] = $createdDate->diff($startDate)->format(Configure::read('Task.dateDiffFormat'));
			$item['startedTimestamp'] = $startDate->getTimestamp();
			$item['runtime'] = (int)$item['runtime'];
			$item['waittime'] = (int)$item['waittime'];
			return $item;
		}, Hash::extract($tasks, '{n}.{s}'));
		
		$runtimes = Hash::extract($statistics, '{n}.runtime');
		$runtimeAverage = (int)round($runtimes ? array_sum($runtimes) / count($runtimes) : 0);
		$runtimeMax = $runtimes ? max($runtimes) : 0;
		$runtimeMin = $runtimes ? min($runtimes) : 0;

		$waittimes = Hash::extract($statistics, '{n}.waittime');
		$waittimeAverage = (int)round($waittimes ? array_sum($waittimes) / count($waittimes) : 0);
		$waittimeMax = $waittimes ? max($waittimes) : 0;
		$waittimeMin = $waittimes ? min($waittimes) : 0;

		$countByStatus = array();
		foreach (TaskType::getTypes() as $statusCode) {
			$countByStatus[$statusCode] = $this->Task->find('count', array(
				'conditions' => array(
					'command' => $command,
					'status' => $statusCode
				)
			));
		}

		$errored = $this->Task->find('count', array(
			'conditions' => array(
				'command' => $command,
				'errored' => true
			)
		));

		return array(
			'command' => $command,
			'countByStatus' => $countByStatus,
			'errored' => $errored,
			'statistics' => $statistics,
			'runtimeAverage' => $runtimeAverage,
			'runtimeAverageHuman' => $this->_secondsToHuman($runtimeAverage),
			'runtimeMax' => $runtimeMax,
			'runtimeMaxHuman' => $this->_secondsToHuman($runtimeMax),
			'runtimeMin' => $runtimeMin,
			'runtimeMinHuman' => $this->_secondsToHuman($runtimeMin),
			'waittimeAverage' => $waittimeAverage,
			'waittimeAverageHuman' => $this->_secondsToHuman($waittimeAverage),
			'waittimeMax' => $waittimeMax,
			'waittimeMaxHuman' => $this->_secondsToHuman($waittimeMax),
			'waittimeMin' => $waittimeMin,
			'waittimeMinHuman' => $this->_secondsToHuman($waittimeMin),
		);
	}
527172
protected function prepareCommand($command)
    {
        if (is_string($command)) {
            return trim($command);
        }
        if (is_array($command)) {
            return implode(' && ', $command);
        }
        throw new TaskExecutionException('Command must be string or array, ' . gettype($command) . ' given.', 1312454906);
    }
556952
protected function executeCommand($command)
    {

        $process = new Process($command);
        $process->run();

        return array(
            $process->getExitCode(),
            $process->getOutput(),
            $process->getErrorOutput(),
        );
    }
184355
public function command($command, array $parameters = [])
    {
        if (class_exists($command)) {
            $command = (new $command)->getName();
        }

        return $this->exec(
            Application::formatCommandString($command), $parameters
        );
    }
1238818
public function getCommand($command): Command
    {
        if (isset($this->aliases[$command])) {
            return $this->aliases[$command];
        }

        if (isset($this->commands[$command])) {
            return $this->commands[$command];
        }

        throw new CommandNotFoundException($this, $command);
    }
39838
protected function help($command = null)
    {
        if ($command && isset(self::$help[$command])) {
            $data = self::$help[$command];
        } else {
            $data = self::$fallbackHelp;
        }

        return $this->render('system/cli/help.phtml', $data);
    }