Conditions | 6 |
Paths | 8 |
Total Lines | 31 |
Code Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 6.1666 |
Changes | 0 |
1 | <?php |
||
32 | 46 | public static function mightHaveAnnotations($entity) |
|
33 | { |
||
34 | 46 | if (is_object($entity)) |
|
35 | { |
||
36 | 46 | if ($entity instanceof Reflector) |
|
37 | { |
||
38 | 46 | if ($entity instanceof ReflectionClass) |
|
39 | { |
||
40 | 37 | $file = $entity->getFileName(); |
|
41 | } |
||
42 | else |
||
43 | { |
||
44 | 46 | $file = $entity->getDeclaringClass()->getFileName(); |
|
45 | } |
||
46 | } |
||
47 | else |
||
48 | { |
||
49 | 46 | $file = (new ReflectionObject($entity))->getFileName(); |
|
50 | } |
||
51 | } |
||
52 | else |
||
53 | { |
||
54 | $file = $entity; |
||
55 | } |
||
56 | 46 | if (empty($file) || !is_string($file)) |
|
57 | { |
||
58 | return false; |
||
59 | } |
||
60 | 46 | $content = file_get_contents($file); |
|
61 | 46 | return !!preg_match('~@[A-Z]~', $content); |
|
62 | } |
||
63 | |||
65 |