TYPO3  7.6
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
CommandManager Class Reference
Inheritance diagram for CommandManager:
SingletonInterface

Public Member Functions

 injectObjectManager (\TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager)
 
 getAvailableCommands ()
 
 getCommandByIdentifier ($commandIdentifier)
 
 getShortestIdentifierForCommand (Command $command)
 

Protected Member Functions

 getShortCommandIdentifiers ()
 
 commandMatchesIdentifier (Command $command, $commandIdentifier)
 

Protected Attributes

 $objectManager
 
 $availableCommands = null
 
 $shortCommandIdentifiers = null
 

Detailed Description

A helper for CLI commands

http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later

Definition at line 22 of file CommandManager.php.

Member Function Documentation

commandMatchesIdentifier ( Command  $command,
  $commandIdentifier 
)
protected

Returns TRUE if the specified command identifier matches the identifier of the specified command. This is the case, if the identifiers are the same or if at least the last two command parts match (case sensitive).

Parameters
Command$command
string$commandIdentifiercommand identifier in the format foo:bar:baz (all lower case)
Returns
bool TRUE if the specified command identifier matches this commands identifier

Definition at line 163 of file CommandManager.php.

References Command\getCommandIdentifier().

Referenced by CommandManager\getCommandByIdentifier().

getAvailableCommands ( )

Returns an array of all commands

Returns
Command[]

Definition at line 53 of file CommandManager.php.

References CommandManager\$availableCommands, and $GLOBALS.

Referenced by CommandManager\getCommandByIdentifier(), and CommandManager\getShortCommandIdentifiers().

getCommandByIdentifier (   $commandIdentifier)

Returns a Command that matches the given identifier. If no Command could be found a CommandNotFoundException is thrown If more than one Command matches an AmbiguousCommandIdentifierException is thrown that contains the matched Commands

Parameters
string$commandIdentifiercommand identifier in the format foo:bar:baz
Returns
Command
Exceptions
\TYPO3\CMS\Extbase\Mvc\Exception\NoSuchCommandExceptionif no matching command is available
\TYPO3\CMS\Extbase\Mvc\Exception\AmbiguousCommandIdentifierExceptionif more than one Command matches the identifier (the exception contains the matched commands)

Definition at line 83 of file CommandManager.php.

References CommandManager\$availableCommands, CommandManager\commandMatchesIdentifier(), and CommandManager\getAvailableCommands().

getShortCommandIdentifiers ( )
protected

Returns an array that contains all available command identifiers and their shortest non-ambiguous alias

Returns
array in the format array('full.command:identifier1' => 'alias1', 'full.command:identifier2' => 'alias2')

Definition at line 129 of file CommandManager.php.

References CommandManager\$shortCommandIdentifiers, and CommandManager\getAvailableCommands().

Referenced by CommandManager\getShortestIdentifierForCommand().

getShortestIdentifierForCommand ( Command  $command)

Returns the shortest, non-ambiguous command identifier for the given command

Parameters
Command$commandThe command
Returns
string The shortest possible command identifier

Definition at line 112 of file CommandManager.php.

References CommandManager\$shortCommandIdentifiers, Command\getCommandIdentifier(), and CommandManager\getShortCommandIdentifiers().

injectObjectManager ( \TYPO3\CMS\Extbase\Object\ObjectManagerInterface  $objectManager)
Parameters
\TYPO3\CMS\Extbase\Object\ObjectManagerInterface$objectManager

Definition at line 42 of file CommandManager.php.

References CommandManager\$objectManager.

Member Data Documentation

$availableCommands = null
protected
$objectManager
protected

Definition at line 27 of file CommandManager.php.

Referenced by CommandManager\injectObjectManager().

$shortCommandIdentifiers = null
protected