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