/** * @param string $extensionKey * @param string $p1 * @param string $p2 * @param string $p3 * @param string $p4 * @param string $p5 * @return string * @return void */ public function indexAction($extensionKey = NULL, $p1 = NULL, $p2 = NULL, $p3 = NULL, $p4 = NULL, $p5 = NULL) { if (!$extensionKey && !$p1 && !$p2 && !$p3 && !$p4 && !$p5) { list($extensionKey, $p1, $p2, $p3, $p4, $p5) = array_pad((array) $this->getBackendUserAuthentication()->getModuleData('tools_schema_arguments'), 6, NULL); } else { $this->getBackendUserAuthentication()->pushModuleData('tools_schema_arguments', array($extensionKey, $p1, $p2, $p3, $p4, $p5)); } if (NULL === $extensionKey) { $extensionKey = 'TYPO3.Fluid'; } list($vendor, $legacyExtensionKey) = $this->schemaService->getRealExtensionKeyAndVendorFromCombinedExtensionKey($extensionKey); $version = ExtensionManagementUtility::getExtensionVersion($extensionKey); $namespaceName = str_replace('_', '', $legacyExtensionKey); $namespaceName = strtolower($namespaceName); $namespaceAlias = str_replace('_', '', $extensionKey); if (isset($this->extensionKeyToNamespaceMap[$legacyExtensionKey])) { $namespaceAlias = $this->extensionKeyToNamespaceMap[$legacyExtensionKey]; } $segments = array($p1, $p2, $p3, $p4, $p5); $segments = $this->trimPathSegments($segments); $arguments = $this->segmentsToArguments($extensionKey, $segments); $extensionName = GeneralUtility::underscoredToUpperCamelCase($legacyExtensionKey); $extensionKeys = $this->detectExtensionsContainingViewHelpers(); $displayHeadsUp = FALSE; if (isset($this->extensionKeyToNamespaceMap[$namespaceName])) { $namespaceName = $this->extensionKeyToNamespaceMap[$namespaceName]; } $tree = $this->buildTreeFromClassPath(ExtensionManagementUtility::extPath($legacyExtensionKey, 'Classes/ViewHelpers/')); $viewHelperArguments = array(); $node = NULL; $docComment = ''; $className = implode('/', $segments); if (TRUE === ExtensionManagementUtility::isLoaded($legacyExtensionKey)) { $extensionPath = ExtensionManagementUtility::extPath($legacyExtensionKey); if (!empty($className)) { $className = $vendor . '\\' . $extensionName . '\\ViewHelpers\\' . str_replace('/', '\\', $className); $viewHelperArguments = $this->objectManager->get($className)->prepareArguments(); $reflection = new ClassReflection($className); $docComment = $reflection->getDocComment(); $this->docCommentParser->parseDocComment($docComment); $docComment = $this->docCommentParser->getDescription(); $docComment = trim($docComment, "/ \n"); } else { $readmeFile = $extensionPath . 'Classes/ViewHelpers/README.md'; if (TRUE === file_exists($readmeFile)) { $readmeFile = file_get_contents($readmeFile); } else { unset($readmeFile); } } } $variables = array('view' => 'Index', 'action' => 'index', 'readmeFile' => $readmeFile, 'history' => $history, 'name' => end($segments), 'schemaFile' => $relativeSchemaFile, 'keys' => array(), 'namespaceUrl' => $targetNamespaceUrl, 'displayHeadsUp' => $displayHeadsUp, 'namespaceName' => $namespaceName, 'namespaceAlias' => $namespaceAlias, 'className' => $className, 'ns' => $namespaceName, 'isFile' => class_exists($className), 'arguments' => $arguments, 'segments' => $segments, 'markdownBlacklisted' => in_array($extensionKey, $this->markdownBlacklistedExtensionKeys), 'viewHelperArguments' => $viewHelperArguments, 'docComment' => $docComment, 'tree' => $tree, 'version' => $version, 'extensionKey' => $extensionKey, 'extensionKeys' => $extensionKeys, 'extensionName' => $extensionName); $this->view->assignMultiple($variables); }
/** * Generate the XML Schema for a given class name. * * @param string $className Class name to generate the schema for. * @param \SimpleXMLElement $xmlRootNode XML root node where the xsd:element is appended. * @return void */ protected function generateXmlForClassName($className, \SimpleXMLElement $xmlRootNode) { $reflectionClass = new ClassReflection($className); if (!$reflectionClass->isSubclassOf($this->abstractViewHelperReflectionClass)) { return; } $tagName = $this->getTagNameForClass($className); $xsdElement = $xmlRootNode->addChild('xsd:element'); $xsdElement['name'] = $tagName; $this->docCommentParser->parseDocComment($reflectionClass->getDocComment()); $this->addDocumentation($this->docCommentParser->getDescription(), $xsdElement); $xsdComplexType = $xsdElement->addChild('xsd:complexType'); $xsdComplexType['mixed'] = 'true'; $xsdSequence = $xsdComplexType->addChild('xsd:sequence'); $xsdAny = $xsdSequence->addChild('xsd:any'); $xsdAny['minOccurs'] = '0'; $xsdAny['maxOccurs'] = '1'; $this->addAttributes($className, $xsdComplexType); }
/** * @param ParameterReflection $parameterReflection * @param string $argumentName * @return array */ protected function parseDocCommentOfArgument(ParameterReflection $parameterReflection, $argumentName) { $docCommentParser = new DocCommentParser(); $docCommentParser->parseDocComment($parameterReflection->getDeclaringFunction()->getDocComment()); $parameterAnnotations = $docCommentParser->getTagValues('param'); foreach ($parameterAnnotations as $parameterAnnotation) { list($type, $name, $description) = explode(' ', $parameterAnnotation, 3); if ($name === '$' . $argumentName) { return [$type, $description]; } } return ['mixed', 'Unknown argument - may not be supported by command controller!']; }