PHP 클래스 Webmozart\Console\Api\Command\CommandCollection

부터: 1.0
저자: Bernhard Schussek ([email protected])
상속: implements ArrayAcces\ArrayAccess, implements IteratorAggregat\IteratorAggregate, implements Countabl\Countable
파일 보기 프로젝트 열기: webmozart/console 1 사용 예제들

공개 메소드들

메소드 설명
__construct ( array $commands = [] ) Creates a new command collection.
add ( Command $command ) Adds a command to the collection.
clear ( ) Removes all commands from the collection.
contains ( string $name ) : boolean Returns whether the collection contains a command with the given name.
count ( )
filterAnonymous ( )
filterDefault ( )
filterNonAnonymous ( )
filterNonDefault ( )
get ( string $name ) : Command Returns a command by its name.
getAliases ( ) : string[] Returns the aliases of all commands in the collection.
getIterator ( )
getNames ( boolean $includeAliases = false ) : string[] Returns the names of all commands in the collection.
isEmpty ( ) : boolean Returns whether the collection is empty.
merge ( array $commands ) Adds multiple commands to the collection.
offsetExists ( $name )
offsetGet ( $name )
offsetSet ( $offset, $command )
offsetUnset ( $name )
remove ( string $name ) Removes the command with the given name from the collection.
replace ( array $commands ) Sets the commands in the collection.
toArray ( ) : Command[] Returns the contents of the collection as array.

메소드 상세

__construct() 공개 메소드

Creates a new command collection.
public __construct ( array $commands = [] )
$commands array The commands to initially add to the collection.

add() 공개 메소드

If a command exists with the same name in the collection, that command is overwritten.
public add ( Command $command )
$command Command The command to add.

clear() 공개 메소드

Removes all commands from the collection.
public clear ( )

contains() 공개 메소드

Returns whether the collection contains a command with the given name.
public contains ( string $name ) : boolean
$name string The name of the command.
리턴 boolean Returns `true` if the collection contains a command with that name and `false` otherwise.

count() 공개 메소드

public count ( )

filterAnonymous() 공개 메소드

public filterAnonymous ( )

filterDefault() 공개 메소드

public filterDefault ( )

filterNonAnonymous() 공개 메소드

public filterNonAnonymous ( )

filterNonDefault() 공개 메소드

public filterNonDefault ( )

get() 공개 메소드

Returns a command by its name.
public get ( string $name ) : Command
$name string The name of the command.
리턴 Command The command.

getAliases() 공개 메소드

The aliases are sorted alphabetically in ascending order.
public getAliases ( ) : string[]
리턴 string[] The command names indexed and sorted by their aliases.

getIterator() 공개 메소드

public getIterator ( )

getNames() 공개 메소드

The names are sorted alphabetically in ascending order. If you set $includeAliases to true, the alias names are included in the result.
public getNames ( boolean $includeAliases = false ) : string[]
$includeAliases boolean Whether to include alias names in the result.
리턴 string[] The sorted command names.

isEmpty() 공개 메소드

Returns whether the collection is empty.
public isEmpty ( ) : boolean
리턴 boolean Returns `true` if the collection is empty and `false` otherwise.

merge() 공개 메소드

Existing commands are preserved. Commands with the same names as the passed commands are overwritten.
public merge ( array $commands )
$commands array The commands to add.

offsetExists() 공개 메소드

public offsetExists ( $name )

offsetGet() 공개 메소드

public offsetGet ( $name )

offsetSet() 공개 메소드

public offsetSet ( $offset, $command )

offsetUnset() 공개 메소드

public offsetUnset ( $name )

remove() 공개 메소드

If no such command can be found, the method does nothing.
public remove ( string $name )
$name string The name of the command.

replace() 공개 메소드

Existing commands are replaced.
public replace ( array $commands )
$commands array The commands to set.

toArray() 공개 메소드

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[]
리턴 Command[] The commands indexed by their names.