/** {@inheritdoc} */ public function runPrinter() { $targets = [Annotation::TARGET_CLASS => "Class", Annotation::TARGET_METHOD => "Method", Annotation::TARGET_PROPERTY => "Property"]; foreach ($targets as $targetIdentifier => $targetName) { $this->printAnnotationsByTarget($targetName, $this->annotationReaderResult->getAnnotationsByTarget($targetIdentifier)); } return $this; }
/** * Validates a reader result against the provided definition. * @param \Brickoo\Component\Common\Collection $collection * @param \Brickoo\Component\Annotation\AnnotationReaderResult $readerResult * @throws \Brickoo\Component\Annotation\Exception\MissingRequiredAnnotationException * @throws \Brickoo\Component\Annotation\Exception\MissingRequiredAnnotationParametersException * @return void */ public function validate(Collection $collection, AnnotationReaderResult $readerResult) { $targets = [Annotation::TARGET_CLASS, Annotation::TARGET_METHOD, Annotation::TARGET_PROPERTY]; $annotationFilter = new AnnotationDefinitionTargetFilter($collection); foreach ($targets as $annotationTarget) { $this->validateAnnotations($annotationFilter->filter($annotationTarget), $readerResult->getAnnotationsByTarget($annotationTarget)); } }
/** * @covers Brickoo\Component\Annotation\AnnotationReaderResult::getAnnotationsByTarget * @covers Brickoo\Component\Annotation\AnnotationReaderResult::isTargetValid * @covers Brickoo\Component\Annotation\Exception\InvalidTargetException * @expectedException \Brickoo\Component\Annotation\Exception\InvalidTargetException */ public function testGetAnnotationsByTargetThrowsInvalidTypeException() { $annotationReaderResult = new AnnotationReaderResult("\\Some\\Class"); $annotationReaderResult->getAnnotationsByTarget(12345); }