| Conditions | 5 |
| Paths | 7 |
| Total Lines | 24 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 30 |
| Changes | 0 | ||
| 1 | <?php declare(strict_types=1); |
||
| 9 | public function build(array $params): array |
||
| 10 | { |
||
| 11 | $conditions = []; |
||
| 12 | foreach ($params as $name => $value) { |
||
| 13 | $method = $this->resolveConditionMethodName($name); |
||
| 14 | if (\method_exists($this, $method)) { |
||
| 15 | $newCondition = $this->$method($value); |
||
| 16 | } else { |
||
| 17 | $newCondition = $this->buildHashCondition($name, $value); |
||
| 18 | } |
||
| 19 | |||
| 20 | if (empty($newCondition)) { |
||
| 21 | continue; |
||
| 22 | } |
||
| 23 | |||
| 24 | if (empty($conditions)) { |
||
| 25 | $conditions = $newCondition; |
||
| 26 | } else { |
||
| 27 | $conditions = ['and', $conditions, $newCondition]; |
||
| 28 | } |
||
| 29 | } |
||
| 30 | |||
| 31 | return $conditions; |
||
| 32 | } |
||
| 33 | |||
| 44 |