src/ShellBuilder.php
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;
    }
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;
    }
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 ; }
Add command to shell.

@param string     $name
@param string     $description
@param array|null $operands
@param array|null $options
@param array|null $parameters
@return ShellBuilder
Add command to shell .