| Conditions | 3 |
| Paths | 3 |
| Total Lines | 22 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 4 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 27 | public function getMetaObject(string $obj): self |
||
| 28 | 2 | { |
|
| 29 | 2 | static $STATIC_CACHE = []; |
|
| 30 | |||
| 31 | $cacheKey = $obj; |
||
| 32 | 2 | if (!empty($STATIC_CACHE[$cacheKey])) { |
|
| 33 | return $STATIC_CACHE[$cacheKey]; |
||
| 34 | 2 | } |
|
| 35 | |||
| 36 | $reflector = new \ReflectionClass($obj); |
||
| 37 | $factory = \phpDocumentor\Reflection\DocBlockFactory::createInstance(); |
||
| 38 | $docblock = $factory->create($reflector->getDocComment()); |
||
| 39 | foreach ($docblock->getTagsByName('property') as $tag) { |
||
| 40 | /** @var \phpDocumentor\Reflection\DocBlock\Tags\Property $tag */ |
||
| 41 | $PropertyName = $tag->getVariableName(); |
||
| 42 | $this->{$PropertyName} = $PropertyName; |
||
| 43 | } |
||
| 44 | |||
| 45 | $STATIC_CACHE[$cacheKey] = $this; |
||
| 46 | |||
| 47 | return $this; |
||
| 48 | } |
||
| 49 | } |
||
| 50 |