Webmozart\Console\Api\Command\CommandCollection::toArray PHP Méthode

toArray() public méthode

The commands in the collection are returned indexed by their names. The result is sorted in the order in which the commands were added to the collection.
public toArray ( ) : Command[]
Résultat Command[] The commands indexed by their names.
    public function toArray()
    {
        return $this->commands;
    }

Usage Example

 public function testReplace()
 {
     $this->collection->add($ls = new Command(new CommandConfig('ls')));
     $this->collection->replace(array($cd = new Command(new CommandConfig('cd')), $cat = new Command(new CommandConfig('cat'))));
     $this->assertSame(array('cd' => $cd, 'cat' => $cat), $this->collection->toArray());
 }