54 if ($this->availableCommands ===
null) {
55 $this->availableCommands = [];
56 foreach (
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'extbase'][
'commandControllers'] ?? [] as $className) {
57 if (!class_exists($className)) {
60 foreach (get_class_methods($className) as $methodName) {
61 if (substr($methodName, -7, 7) ===
'Command') {
62 $this->availableCommands[] = $this->objectManager->get(\
TYPO3\CMS\
Extbase\Mvc\Cli\Command::class, $className, substr($methodName, 0, -7));
82 $commandIdentifier = strtolower(trim($commandIdentifier));
83 if ($commandIdentifier ===
'help') {
84 $commandIdentifier =
'extbase:help:help';
86 $matchedCommands = [];
90 $matchedCommands[] = $command;
93 if (empty($matchedCommands)) {
94 throw new \TYPO3\CMS\Extbase\Mvc\Exception\NoSuchCommandException(
'No command could be found that matches the command identifier "' . $commandIdentifier .
'".', 1310556663);
96 if (count($matchedCommands) > 1) {
97 throw new \TYPO3\CMS\Extbase\Mvc\Exception\AmbiguousCommandIdentifierException(
'More than one command matches the command identifier "' . $commandIdentifier .
'"', 1310557169,
null, $matchedCommands);
99 return current($matchedCommands);
127 if ($this->shortCommandIdentifiers ===
null) {
128 $commandsByCommandName = [];
130 list($extensionKey, $controllerName, $commandName) = explode(
':', $availableCommand->getCommandIdentifier());
131 if (!isset($commandsByCommandName[$commandName])) {
132 $commandsByCommandName[$commandName] = [];
134 if (!isset($commandsByCommandName[$commandName][$controllerName])) {
135 $commandsByCommandName[$commandName][$controllerName] = [];
137 $commandsByCommandName[$commandName][$controllerName][] = $extensionKey;
140 list($extensionKey, $controllerName, $commandName) = explode(
':', $availableCommand->getCommandIdentifier());
141 if (count($commandsByCommandName[$commandName][$controllerName]) > 1) {
142 $this->shortCommandIdentifiers[$availableCommand->getCommandIdentifier()] = sprintf(
'%s:%s:%s', $extensionKey, $controllerName, $commandName);
144 $this->shortCommandIdentifiers[$availableCommand->getCommandIdentifier()] = sprintf(
'%s:%s', $controllerName, $commandName);
162 $searchedCommandIdentifierParts = explode(
':', $commandIdentifier);
163 $extensionKey = array_shift($commandIdentifierParts);
164 if (count($searchedCommandIdentifierParts) === 3) {
165 $searchedExtensionKey = array_shift($searchedCommandIdentifierParts);
166 if ($searchedExtensionKey !== $extensionKey) {
170 if (count($searchedCommandIdentifierParts) !== 2) {
173 return $searchedCommandIdentifierParts === $commandIdentifierParts;