| Total Complexity | 4 |
| Total Lines | 40 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php declare(strict_types=1); |
||
| 16 | final class ReflectionProperty extends BaseReflectionProperty |
||
| 17 | { |
||
| 18 | private $level; |
||
| 19 | |||
| 20 | private function __construct($class, string $name, int $level) |
||
| 21 | { |
||
| 22 | parent::__construct($class, $name); |
||
| 23 | $this->setAccessible(true); |
||
| 24 | $this->level = $level; |
||
| 25 | } |
||
| 26 | |||
| 27 | /** |
||
| 28 | * Transforms a base ReflectionProperty into a custom ReflectionProperty. |
||
| 29 | * |
||
| 30 | * @param BaseReflectionProperty $property The property to convert. |
||
| 31 | * @param int $level The inheritance deepness. |
||
| 32 | * @return ReflectionProperty The converted property. |
||
| 33 | * @throws ReflectionException When the property cannot be |
||
| 34 | * accessed. |
||
| 35 | */ |
||
| 36 | public static function from( |
||
| 37 | BaseReflectionProperty $property, |
||
| 38 | int $level |
||
| 39 | ): ReflectionProperty { |
||
| 40 | return new ReflectionProperty( |
||
| 41 | $property->class, |
||
| 42 | $property->name, |
||
| 43 | $level |
||
| 44 | ); |
||
| 45 | } |
||
| 46 | |||
| 47 | public function getName(): string |
||
| 56 | ); |
||
| 57 | } |
||
| 58 | } |
||
| 59 |