Conditions | 4 |
Paths | 7 |
Total Lines | 17 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 4 |
Changes | 0 |
1 | <?php |
||
19 | function buildStubs(array $namesWithValues): StubSet |
||
20 | { |
||
21 | 81 | $stubSet = new StubSet(); |
|
22 | 81 | foreach ($namesWithValues as $name => $value) { |
|
23 | try { |
||
24 | 81 | $stub = StubHelper::isPropertyName($name) |
|
25 | 80 | ? new PropertyStub($name, $value) |
|
26 | 80 | : new MethodStub($name, $value); |
|
27 | |||
28 | 80 | $stubSet->add($stub); |
|
29 | 1 | } catch (\Error $error) { |
|
30 | 81 | throw new InvalidArgumentException($error->getMessage()); |
|
31 | } |
||
32 | } |
||
33 | |||
34 | 80 | return $stubSet; |
|
35 | } |
||
36 |