| Conditions | 6 |
| Paths | 5 |
| Total Lines | 15 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 23 | public function getAnnotation(string $name, $class, string $method = null) { |
||
| 24 | if(!$this->isAvailable()) { |
||
| 25 | return null; |
||
| 26 | } |
||
| 27 | $attributeClassName = $this->getClassName($name); |
||
| 28 | if($method !== null) { |
||
| 29 | $reflection = new ReflectionMethod(is_object($class) ? get_class($class) : $class, $method); |
||
| 30 | } else { |
||
| 31 | $reflection = new \ReflectionClass(is_object($class) ? get_class($class) : $class); |
||
| 32 | } |
||
| 33 | $attributes = $reflection->getAttributes($attributeClassName); |
||
| 34 | if(count($attributes) === 0) { |
||
| 35 | return null; |
||
| 36 | } |
||
| 37 | return $attributes[0]; |
||
| 38 | } |
||
| 48 | ?> |