| Conditions | 3 |
| Paths | 3 |
| Total Lines | 21 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 13 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 14 | 7 | public function getMetaObject(string $obj) { |
|
| 15 | 7 | static $STATIC_CACHE = array(); |
|
| 16 | |||
| 17 | 7 | $cacheKey = $obj; |
|
| 18 | 7 | if (!empty($STATIC_CACHE[$cacheKey])) { |
|
| 19 | 6 | return $STATIC_CACHE[$cacheKey]; |
|
| 20 | } |
||
| 21 | |||
| 22 | 2 | $reflector = new \ReflectionClass($obj); |
|
| 23 | 2 | $factory = \phpDocumentor\Reflection\DocBlockFactory::createInstance(); |
|
| 24 | 2 | $docblock = $factory->create($reflector->getDocComment()); |
|
| 25 | 2 | foreach ($docblock->getTagsByName('property') as $tag) { |
|
| 26 | /* @var $tag \phpDocumentor\Reflection\DocBlock\Tags\Property */ |
||
| 27 | 2 | $PropertyName = $tag->getVariableName(); |
|
| 28 | 2 | $this->{$PropertyName} = $PropertyName; |
|
| 29 | } |
||
| 30 | |||
| 31 | 2 | $STATIC_CACHE[$cacheKey] = $this; |
|
| 32 | |||
| 33 | 2 | return $this; |
|
| 34 | } |
||
| 35 | } |
||
| 36 |