1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- <?php
- declare(strict_types=1);
- /**
- * This file is part of Hyperf.
- *
- * @link https://www.hyperf.io
- * @document https://hyperf.wiki
- * @contact group@hyperf.io
- * @license https://github.com/hyperf/hyperf/blob/master/LICENSE
- */
- namespace Hyperf\Di\Annotation;
- use Hyperf\Contract\Arrayable;
- use Hyperf\Di\ReflectionManager;
- use ReflectionProperty;
- abstract class AbstractAnnotation implements AnnotationInterface, Arrayable
- {
- public function toArray(): array
- {
- $properties = ReflectionManager::reflectClass(static::class)->getProperties(ReflectionProperty::IS_PUBLIC);
- $result = [];
- foreach ($properties as $property) {
- $result[$property->getName()] = $property->getValue($this);
- }
- return $result;
- }
- public function collectClass(string $className): void
- {
- AnnotationCollector::collectClass($className, static::class, $this);
- }
- public function collectClassConstant(string $className, ?string $target): void
- {
- AnnotationCollector::collectClassConstant($className, $target, static::class, $this);
- }
- public function collectMethod(string $className, ?string $target): void
- {
- AnnotationCollector::collectMethod($className, $target, static::class, $this);
- }
- public function collectProperty(string $className, ?string $target): void
- {
- AnnotationCollector::collectProperty($className, $target, static::class, $this);
- }
- }
|