/** * * * @param \ReflectionClass $reflectionClass * @return {string:\perf\Annotation\Annotation[]} * @throws \RuntimeException */ public function extract(\ReflectionClass $reflectionClass) { $propertiesFilter = \ReflectionProperty::IS_PUBLIC | \ReflectionProperty::IS_PROTECTED | \ReflectionProperty::IS_PRIVATE; $annotations = array(); foreach ($reflectionClass->getProperties($propertiesFilter) as $reflectionProperty) { $docComment = $reflectionProperty->getDocComment(); if (false === $docComment) { continue; } $propertyName = $reflectionProperty->getName(); $annotations[$propertyName] = $this->docBlockAnnotationParser->parse($docComment); } return $annotations; }
/** * * * @param \ReflectionClass $reflectionClass * @return Annotation[] * @throws \RuntimeException */ private function getAllAnnotations(\ReflectionClass $reflectionClass) { $docComment = $reflectionClass->getDocComment(); if (false == $docComment) { throw new \RuntimeException("Doc block is missing."); } $annotations = $this->docBlockAnnotationParser->parse($docComment); if (count($annotations) < 1) { throw new \RuntimeException("Doc block does not contain annotations."); } return $annotations; }