Conditions | 6 |
Paths | 5 |
Total Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 42 |
Changes | 0 |
1 | <?php |
||
23 | public static function getClassFromDocComment($comment, $includeNamespaces = true, $reflectionClass = null) |
||
24 | { |
||
25 | if (preg_match('~\@var[\s]+([A-Za-z0-9\\\\]+)~', $comment, $matches)) { |
||
26 | if ($includeNamespaces) { |
||
27 | if ($reflectionClass instanceof \ReflectionClass && !in_array($matches[1], HydratableTrait::$nonObjectTypes)) { |
||
28 | return ($reflectionClass->getNamespaceName()) ? sprintf('\%s\%s', $reflectionClass->getNamespaceName(), $matches[1]) : sprintf('\%s', $matches[1]); |
||
29 | } |
||
30 | return $matches[1]; |
||
31 | } |
||
32 | return join('', array_slice(explode('\\', $matches[1]), -1)); |
||
33 | } |
||
34 | |||
35 | return false; |
||
36 | } |
||
37 | } |