Conditions | 4 |
Paths | 4 |
Total Lines | 14 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 4 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
41 | 3 | public function setGears(array $gears): Gears |
|
42 | { |
||
43 | 3 | $gstack = []; |
|
44 | 3 | if ($gears[0] instanceof Gear) { |
|
|
|||
45 | 1 | $this->gears = $gears; |
|
46 | 1 | return $this; |
|
47 | } |
||
48 | 3 | foreach ($gears as $p) { |
|
49 | 3 | if ($p instanceof \stdClass) { |
|
50 | 3 | $gstack[] = (new Gear())->hydrate($p); |
|
51 | } |
||
52 | } |
||
53 | 3 | $this->gears = $gstack; |
|
54 | 3 | return $this; |
|
55 | } |
||
57 |