Clinner\Command\Command::create PHP Method

create() public static method

Factory method for creating new Commands and allowing to take advantage of the fluent API provided by this class.
public static create ( string $name, array | ValueHolder $arguments = [], array | ValueHolder $options = [] ) : Command
$name string The name of the command.
$arguments array | Clinner\ValueHolder (Optional) arguments for the command.
$options array | Clinner\ValueHolder (Optional) options for the command.
return Command
    public static function create($name, $arguments = array(), $options = array())
    {
        return new static($name, $arguments, $options);
    }

Usage Example

Example #1
0
 /**
  * @covers \Clinner\Command\Command::create
  */
 public function testStaticCreateWithArgsAndOpts()
 {
     $name = 'ls';
     $args = array('first' => 'value', 'second' => 'second value');
     $opts = array('some_option' => 'some value');
     $command = Command::create($name, $args, $opts);
     $this->assertInstanceOf('\\Clinner\\Command\\Command', $command);
     $this->assertAttributeEquals($name, '_name', $command);
     $this->assertAttributeInstanceOf('\\Clinner\\ValueHolder', '_arguments', $command);
     $this->assertAttributeInstanceOf('\\Clinner\\ValueHolder', '_options', $command);
     $this->assertAttributeEmpty('_next', $command);
     $this->assertAttributeEmpty('_exitCode', $command);
     $this->assertAttributeEmpty('_output', $command);
 }
All Usage Examples Of Clinner\Command\Command::create