public function getCommandByIdentifier(string $commandIdentifier): Command
    {
        $commandIdentifier = strtolower(trim($commandIdentifier));
        if ($commandIdentifier === 'help') {
            $commandIdentifier = 'neos.flow:help:help';
        }
        if ($commandIdentifier === 'sys') {
            $commandIdentifier = 'neos.flow:cache:sys';
        }

        $matchedCommands = $this->getCommandsByIdentifier($commandIdentifier);
        if (count($matchedCommands) === 0) {
            throw new NoSuchCommandException('No command could be found that matches the command identifier "' . $commandIdentifier . '".', 1310556663);
        }
        if (count($matchedCommands) > 1) {
            throw new AmbiguousCommandIdentifierException('More than one command matches the command identifier "' . $commandIdentifier . '"', 1310557169, null, $matchedCommands);
        }

        return current($matchedCommands);
    }
public function getCommandByIdentifier(string $commandIdentifier): Command
    {
        $commandIdentifier = strtolower(trim($commandIdentifier));
        if ($commandIdentifier === 'help') {
            $commandIdentifier = 'neos.flow:help:help';
        }
        if ($commandIdentifier === 'sys') {
            $commandIdentifier = 'neos.flow:cache:sys';
        }

        $matchedCommands = $this->getCommandsByIdentifier($commandIdentifier);
        if (count($matchedCommands) === 0) {
            throw new NoSuchCommandException('No command could be found that matches the command identifier "' . $commandIdentifier . '".', 1310556663);
        }
        if (count($matchedCommands) > 1) {
            throw new AmbiguousCommandIdentifierException('More than one command matches the command identifier "' . $commandIdentifier . '"', 1310557169, null, $matchedCommands);
        }

        return current($matchedCommands);
    }
public function getCommandByIdentifier ( string $ commandIdentifier ) : Command { $ commandIdentifier = strtolower ( trim ( $ commandIdentifier ) ) ; if ( $ commandIdentifier === 'help' ) { $ commandIdentifier = 'neos.flow:help:help' ; } if ( $ commandIdentifier === 'sys' ) { $ commandIdentifier = 'neos.flow:cache:sys' ; } $ matchedCommands = $ this -> getCommandsByIdentifier ( $ commandIdentifier ) ; if ( count ( $ matchedCommands ) === 0 ) { throw new NoSuchCommandException ( 'No command could be found that matches the command identifier "' . $ commandIdentifier . '".' , 1310556663 ) ; } if ( count ( $ matchedCommands ) > 1 ) { throw new AmbiguousCommandIdentifierException ( 'More than one command matches the command identifier "' . $ commandIdentifier . '"' , 1310557169 , null , $ matchedCommands ) ; } return current ( $ matchedCommands ) ; }
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

@param string $commandIdentifier command identifier in the format foo:bar:baz
@return Command
@throws NoSuchCommandException if no matching command is available
@throws AmbiguousCommandIdentifierException if more than one Command matches the identifier (the exception contains the matched commands)
@api
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