| Conditions | 2 |
| Paths | 2 |
| Total Lines | 15 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 19 | public function read(object $class, ?string $method = null): array |
||
| 20 | { |
||
| 21 | $attributes = (new \ReflectionClass($class))->getAttributes(AttributeReader::ATTRIBUTE); |
||
| 22 | |||
| 23 | if ($method !== null) { |
||
| 24 | $attributes = array_merge( |
||
| 25 | $attributes, |
||
| 26 | (new \ReflectionMethod($class, $method))->getAttributes(AttributeReader::ATTRIBUTE) |
||
| 27 | ); |
||
| 28 | } |
||
| 29 | |||
| 30 | return array_map(static function (\ReflectionAttribute $attribute): object { |
||
| 31 | /** @var Middleware */ |
||
| 32 | return $attribute->newInstance(); |
||
| 33 | }, $attributes); |
||
| 34 | } |
||
| 36 |