Conditions | 5 |
Paths | 5 |
Total Lines | 12 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
45 | |||
46 | public function getCategoryFromId(string $categoryId): Category { |
||
47 | foreach ($this->categories as $category) { |
||
48 | if ($category->category_id === $categoryId) { |
||
49 | return $category; |
||
50 | } |
||
51 | } |
||
52 | throw new InvalidArgumentException("Category $categoryId not found in register"); |
||
53 | } |
||
54 | } |
||
55 |