2 declare(strict_types = 1);
18 use Symfony\Component\Console\Command\Command;
19 use TYPO3\CMS\Core\Package\PackageManager;
52 $this->packageManager =
$packageManager ?: GeneralUtility::makeInstance(PackageManager::class);
61 foreach ($this->commands as $commandName => $command) {
62 yield $commandName => $command;
74 foreach ($this->commands as $commandName => $command) {
75 if ($this->commandConfigurations[$commandName][
'schedulable'] ??
true) {
76 yield $commandName => $command;
91 if (!isset($this->commands[$identifier])) {
93 sprintf(
'Command "%s" has not been registered.', $identifier),
98 return $this->commands[$identifier] ??
null;
118 if ($this->commands) {
121 foreach ($this->packageManager->getActivePackages() as $package) {
122 $commandsOfExtension = $package->getPackagePath() .
'Configuration/Commands.php';
123 if (@is_file($commandsOfExtension)) {
131 foreach (
$commands as $commandName => $commandConfig) {
132 if (array_key_exists($commandName, $this->commands)) {
134 'Command "' . $commandName .
'" registered by "' . $package->getPackageKey() .
'" is already in use',
138 $this->commands[$commandName] = GeneralUtility::makeInstance($commandConfig[
'class'], $commandName);
139 $this->commandConfigurations[$commandName] = $commandConfig;