Conditions | 5 |
Paths | 8 |
Total Lines | 26 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Tests | 11 |
CRAP Score | 5.0144 |
Changes | 0 |
1 | <?php |
||
44 | 3 | public function load($arg) |
|
45 | { |
||
46 | 3 | $filename = $arg; |
|
47 | |||
48 | if ( |
||
49 | 3 | class_exists($arg, true) |
|
50 | || |
||
51 | 3 | trait_exists($arg, true)) |
|
52 | { |
||
53 | 1 | $filename = (new \ReflectionClass($arg))->getFileName(); |
|
54 | } |
||
55 | |||
56 | 3 | if (null !== $this->introspector) { |
|
57 | $this->traverser->removeVisitor($this->introspector); |
||
58 | } |
||
59 | |||
60 | 3 | $this->traverser->addVisitor($this->introspector = new FileMetadataIntrospectionVisitor($filename)); |
|
61 | |||
62 | 3 | if (!file_exists($filename)) { |
|
63 | 1 | throw new RuntimeException(sprintf('Unable to load file metadata from "%s".', $arg)); |
|
64 | } |
||
65 | |||
66 | 2 | $this->traverser->traverse($this->parser->parse(file_get_contents($filename))); |
|
|
|||
67 | |||
68 | 2 | return $this->introspector->getMetadata(); |
|
69 | } |
||
70 | |||
81 |
This check looks at variables that are passed out again to other methods.
If the outgoing method call has stricter type requirements than the method itself, an issue is raised.
An additional type check may prevent trouble.