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