2 namespace TYPO3\CMS\Extbase\Mvc\Cli;
90 if (isset($classNameParts[0]) && $classNameParts[0] ===
'TYPO3' && isset($classNameParts[1]) && $classNameParts[1] ===
'CMS') {
91 $classNameParts[0] .=
'\\' . $classNameParts[1];
92 unset($classNameParts[1]);
93 $classNameParts = array_values($classNameParts);
95 $numberOfClassNameParts = count($classNameParts);
96 if ($numberOfClassNameParts < 3) {
97 throw new \InvalidArgumentException(
98 'Controller class names must at least consist of three parts: vendor, extension name and path.',
102 if (strpos($classNameParts[$numberOfClassNameParts - 1],
'CommandController') ===
false) {
103 throw new \InvalidArgumentException(
104 'Invalid controller class name "' .
$controllerClassName .
'". Class name must end with "CommandController".',
109 $this->extensionName = $classNameParts[1];
110 $extensionKey = \TYPO3\CMS\Core\Utility\GeneralUtility::camelCaseToLowerCaseUnderscored($this->extensionName);
111 $this->commandIdentifier = strtolower($extensionKey .
':' . substr($classNameParts[$numberOfClassNameParts - 1], 0, -17) .
':' .
$controllerCommandName);
158 return !empty($lines) ? trim($lines[0]) :
'<no description available>';
172 $descriptionLines = array();
173 foreach ($lines as $line) {
174 $trimmedLine = trim($line);
175 if ($descriptionLines !== array() || $trimmedLine !==
'') {
176 $descriptionLines[] = $trimmedLine;
179 return implode(LF, $descriptionLines);
204 $commandArgumentDefinitions = array();
207 $commandParameters = $this->reflectionService->getMethodParameters($this->controllerClassName, $this->controllerCommandName .
'Command');
209 foreach ($commandParameters as $commandParameterName => $commandParameterDefinition) {
210 $explodedAnnotation = preg_split(
'/\s+/', $annotations[
'param'][$i], 3);
211 $description = !empty($explodedAnnotation[2]) ? $explodedAnnotation[2] :
'';
212 $required = $commandParameterDefinition[
'optional'] !==
true;
213 $commandArgumentDefinitions[] = $this->objectManager->get(\TYPO3\CMS\Extbase\Mvc\Cli\CommandArgumentDefinition::class, $commandParameterName, $required, $description);
216 return $commandArgumentDefinitions;
265 $relatedCommandIdentifiers = array();
267 if (preg_match(
'/^[\\w\\d\\.]+:[\\w\\d]+:[\\w\\d]+$/', $tagValue) === 1) {
268 $relatedCommandIdentifiers[] = $tagValue;
271 return $relatedCommandIdentifiers;
279 if ($this->commandMethodReflection === null) {
280 $this->commandMethodReflection = $this->objectManager->get(\TYPO3\CMS\Extbase\Reflection\MethodReflection::class, $this->controllerClassName, $this->controllerCommandName .
'Command');