| Conditions | 3 |
| Paths | 4 |
| Total Lines | 11 |
| Code Lines | 5 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 12 |
| Changes | 0 | ||
| 1 | <?php |
||
| 34 | public function getAll(int $type = null): array |
||
| 35 | { |
||
| 36 | if ($this->commodityArray === null) { |
||
| 37 | $this->commodityArray = $this->commodityRepository->getAll(); |
||
| 38 | } |
||
| 39 | |||
| 40 | if ($type !== null) { |
||
| 41 | return array_filter($this->commodityArray, fn (CommodityInterface $commodity) => $commodity->getType() === $type); |
||
|
|
|||
| 42 | } |
||
| 43 | |||
| 44 | return $this->commodityArray; |
||
| 45 | } |
||
| 47 |