/** * {@inheritDoc} */ public function __toString() { $ctor = $this->class->getConstructor(); if ($this->isFieldsIntercepted && (!$ctor || !$ctor->isPrivate())) { $this->addFieldInterceptorsCode($ctor); } $prefix = join(' ', Reflection::getModifierNames($this->class->getModifiers())); $classCode = $this->class->getDocComment() . "\n" . ($prefix ? "{$prefix} " : '') . 'class ' . $this->name . ' extends ' . $this->parentClassName . ($this->interfaces ? ' implements ' . join(', ', $this->interfaces) : '') . "\n" . "{\n" . ($this->traits ? $this->indent('use ' . join(', ', $this->traits) . ';' . "\n") : '') . "\n" . $this->indent(join("\n", $this->propertiesCode)) . "\n" . $this->indent(join("\n", $this->methodsCode)) . "\n" . "}"; return $classCode . PHP_EOL . '\\' . __CLASS__ . "::injectJoinPoints('" . $this->class->name . "'," . var_export($this->advices, true) . ");"; }
/** * Gets the annotations applied to a class. * * @param ParsedReflectionClass $class The ReflectionClass of the class from which * the class annotations should be read. * @return array An array of Annotations. */ public function getClassAnnotations(ParsedReflectionClass $class) { $this->parser->setTarget(Target::TARGET_CLASS); return $this->parser->parse($class->getDocComment(), 'class ' . $class->getName()); }
protected function getParser() { return new CommentParser($this->reflection->getDocComment()); }