Inheritance: extends ReflectionClass
 /**
  * Generate the XML Schema for a given class name.
  *
  * @param string $className Class name to generate the schema for.
  * @param string $viewHelperNamespace Namespace prefix. Used to split off the first parts of the class name.
  * @param \SimpleXMLElement $xmlRootNode XML root node where the xsd:element is appended.
  * @return void
  */
 protected function generateXmlForClassName($className, $viewHelperNamespace, \SimpleXMLElement $xmlRootNode)
 {
     $reflectionClass = new ClassReflection($className);
     if (!$reflectionClass->isSubclassOf($this->abstractViewHelperReflectionClass)) {
         return;
     }
     $tagName = $this->getTagNameForClass($className, $viewHelperNamespace);
     $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'] = 'unbounded';
     $this->addAttributes($className, $xsdComplexType);
 }
 /**
  * @test
  */
 public function getParentClassReturnsFlowsClassReflection()
 {
     $class = new ClassReflection(__CLASS__);
     $parentClass = $class->getParentClass();
     $this->assertInstanceOf(ClassReflection::class, $parentClass);
 }
 /**
  * Builds the class documentation block for the specified class keeping doc comments and vital annotations
  *
  * @return string $methodDocumentation DocComment for the given method
  */
 protected function buildClassDocumentation()
 {
     $classDocumentation = "/**\n";
     $classReflection = new ClassReflection($this->fullOriginalClassName);
     $classDescription = $classReflection->getDescription();
     $classDocumentation .= ' * ' . str_replace("\n", "\n * ", $classDescription) . "\n";
     foreach ($this->reflectionService->getClassAnnotations($this->fullOriginalClassName) as $annotation) {
         $classDocumentation .= ' * ' . Compiler::renderAnnotation($annotation) . "\n";
     }
     $classDocumentation .= " */\n";
     return $classDocumentation;
 }
示例#4
0
 /**
  * Finds all parent classes of the given class
  *
  * @param ClassReflection $class The class to reflect
  * @param array $parentClasses Array of parent classes
  * @return array<ClassReflection>
  */
 protected function getParentClasses(ClassReflection $class, array $parentClasses = [])
 {
     $parentClass = $class->getParentClass();
     if ($parentClass !== false) {
         $parentClasses[] = $parentClass;
         $parentClasses = $this->getParentClasses($parentClass, $parentClasses);
     }
     return $parentClasses;
 }
 /**
  * @test
  */
 public function proxiedFinalClassesAreStillFinal()
 {
     $reflectionClass = new ClassReflection(Fixtures\FinalClassWithDependencies::class);
     $this->assertTrue($reflectionClass->isFinal());
 }