Conditions | 2 |
Paths | 2 |
Total Lines | 15 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 5 | ||
Bugs | 2 | Features | 2 |
1 | <?php |
||
33 | public function by(callable $func) |
||
34 | { |
||
35 | $overwriteVal = $func($this->criteria); |
||
36 | if ($this->isEnd($overwriteVal)) { |
||
37 | $this->containerCollection->index = 0; |
||
38 | return $this->containerCollection; |
||
39 | } |
||
40 | |||
41 | $this->containerCollection->index += 1; |
||
42 | $this->criteria = $overwriteVal; |
||
43 | $container = $this->containerCollection->get()->with([$this->targetKey => $overwriteVal]); |
||
44 | $this->containerCollection->add($container); |
||
45 | |||
46 | return $this->by($func); |
||
47 | } |
||
48 | |||
55 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: