Clinner\Command\Command::toCommandString PHP Method

toCommandString() public method

Get a string representation of this command with its arguments, as if it would be written in a command-line interface when run.
public toCommandString ( boolean $includePiped = false ) : string
$includePiped boolean (Optional) indicates whether the resulting string will include any piped command to this one. Defaults to FALSE.
return string
    public function toCommandString($includePiped = false)
    {
        $command = $this->getName();
        if (!$this->getArguments()->isEmpty()) {
            $args = array();
            $delimiter = $this->getOption('delimiter', self::DEFAULT_DELIMITER);
            foreach ($this->getArguments()->getAll() as $key => $value) {
                if (is_int($key)) {
                    $args[] = $value;
                } else {
                    $args[] = $key . $delimiter . $value;
                }
            }
            $command .= ' ' . implode(' ', $args);
        }
        if ($includePiped && $this->hasPipedCommand()) {
            $command .= sprintf(' %s %s', self::PIPE, $this->getPipedCommand()->toCommandString($includePiped));
        }
        return $command;
    }