/**
  * 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 \TYPO3\Flow\Reflection\ClassReflection($this->fullOriginalClassName);
     $classDescription = $classReflection->getDescription();
     $classDocumentation .= ' * ' . str_replace("\n", "\n * ", $classDescription) . "\n";
     foreach ($this->reflectionService->getClassAnnotations($this->fullOriginalClassName) as $annotation) {
         $classDocumentation .= ' * ' . \TYPO3\Flow\Object\Proxy\Compiler::renderAnnotation($annotation) . "\n";
     }
     $classDocumentation .= " */\n";
     return $classDocumentation;
 }
 /**
  * @dataProvider annotationsAndStrings
  * @test
  */
 public function renderAnnotationRendersCorrectly($annotation, $expectedString)
 {
     $this->assertEquals($expectedString, Compiler::renderAnnotation($annotation));
 }
 /**
  * Builds the method documentation block for the specified method keeping the vital annotations
  *
  * @param string $className Name of the class the method is declared in
  * @param string $methodName Name of the method to create the parameters code for
  * @return string $methodDocumentation DocComment for the given method
  */
 protected function buildMethodDocumentation($className, $methodName)
 {
     $methodDocumentation = "\t/**\n\t * Autogenerated Proxy Method\n";
     if ($this->reflectionService->hasMethod($className, $methodName)) {
         $methodTags = $this->reflectionService->getMethodTagsValues($className, $methodName);
         $allowedTags = array('param', 'return', 'throws');
         foreach ($methodTags as $tag => $values) {
             if (in_array($tag, $allowedTags)) {
                 if (count($values) === 0) {
                     $methodDocumentation .= '	 * @' . $tag . "\n";
                 } else {
                     foreach ($values as $value) {
                         $methodDocumentation .= '	 * @' . $tag . ' ' . $value . "\n";
                     }
                 }
             }
         }
         $methodAnnotations = $this->reflectionService->getMethodAnnotations($className, $methodName);
         foreach ($methodAnnotations as $annotation) {
             $methodDocumentation .= '	 * ' . \TYPO3\Flow\Object\Proxy\Compiler::renderAnnotation($annotation) . "\n";
         }
     }
     $methodDocumentation .= "\t */\n";
     return $methodDocumentation;
 }
예제 #4
0
 /**
  * @dataProvider annotationsAndStrings
  * @test
  */
 public function renderAnnotationRendersCorrectly($annotation, $expectedString)
 {
     $this->assertEquals($expectedString, \TYPO3\Flow\Object\Proxy\Compiler::renderAnnotation($annotation));
 }