Conditions | 3 |
Paths | 3 |
Total Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 3.0175 |
Changes | 0 |
1 | <?php |
||
59 | 2 | protected function resolve($name) |
|
60 | { |
||
61 | 2 | $config = $this->getConfigStore($name); |
|
62 | |||
63 | 2 | if (is_null($config)) { |
|
64 | 2 | if ($name == 'file') { |
|
65 | 2 | $config = ['driver' => 'file']; |
|
66 | } else { |
||
67 | throw new InvalidArgumentException("Cache store [{$name}] is not defined."); |
||
68 | } |
||
69 | } |
||
70 | |||
71 | 2 | return $this->repository( |
|
72 | 2 | $this->createDriver($config['driver'], $config) |
|
73 | ); |
||
74 | } |
||
75 | |||
85 |
This check looks for methods that are used by a trait but not required by it.
To illustrate, let’s look at the following code example
The trait
Idable
provides a methodequalsId
that in turn relies on the methodgetId()
. If this method does not exist on a class mixing in this trait, the method will fail.Adding the
getId()
as an abstract method to the trait will make sure it is available.