Neos\Flow\Cli\Command::getCommandIdentifier PHP Method

getCommandIdentifier() public method

Returns the command identifier for this command
public getCommandIdentifier ( ) : string
return string The command identifier for this command, following the pattern packagekey:controllername:commandname
    public function getCommandIdentifier()
    {
        return $this->commandIdentifier;
    }

Usage Example

 /**
  * Returns TRUE if the specified command identifier matches the identifier of the specified command.
  * This is the case, if
  *  - the identifiers are the same
  *  - if at least the last two command parts match (case sensitive) or
  *  - if only the package key is specified and matches the commands package key
  * The first part (package key) can be reduced to the last subpackage, as long as the result is unambiguous.
  *
  * @param Command $command
  * @param string $commandIdentifier command identifier in the format foo:bar:baz (all lower case)
  * @return boolean TRUE if the specified command identifier matches this commands identifier
  */
 protected function commandMatchesIdentifier(Command $command, $commandIdentifier)
 {
     $commandIdentifierParts = explode(':', $command->getCommandIdentifier());
     $searchedCommandIdentifierParts = explode(':', $commandIdentifier);
     $packageKey = array_shift($commandIdentifierParts);
     $searchedCommandIdentifierPartsCount = count($searchedCommandIdentifierParts);
     if ($searchedCommandIdentifierPartsCount === 3 || $searchedCommandIdentifierPartsCount === 1) {
         $searchedPackageKey = array_shift($searchedCommandIdentifierParts);
         if ($searchedPackageKey !== $packageKey && substr($packageKey, -(strlen($searchedPackageKey) + 1)) !== '.' . $searchedPackageKey) {
             return false;
         }
     }
     if ($searchedCommandIdentifierPartsCount === 1) {
         return true;
     } elseif (count($searchedCommandIdentifierParts) !== 2) {
         return false;
     }
     return $searchedCommandIdentifierParts === $commandIdentifierParts;
 }
All Usage Examples Of Neos\Flow\Cli\Command::getCommandIdentifier