| @@ 21-28 (lines=8) @@ | ||
| 18 | $this->repository[$car->getId()] = $car; |
|
| 19 | } |
|
| 20 | ||
| 21 | public function find($carId) |
|
| 22 | { |
|
| 23 | if (!array_key_exists($carId, $this->repository)) { |
|
| 24 | throw new CarNotFoundException('Nie znaleziono samochodu o podanym id = '.$carId); |
|
| 25 | } |
|
| 26 | ||
| 27 | return $this->repository[$carId]; |
|
| 28 | } |
|
| 29 | ||
| 30 | public function isEmpty() |
|
| 31 | { |
|
| @@ 35-43 (lines=9) @@ | ||
| 32 | return (!count($this->repository)) ?: false; |
|
| 33 | } |
|
| 34 | ||
| 35 | public function remove($carId) |
|
| 36 | { |
|
| 37 | if (!array_key_exists($carId, $this->repository)) { |
|
| 38 | throw new CarNotFoundException('Nie znaleziono samochodu o podanym id = '.$carId); |
|
| 39 | } |
|
| 40 | ||
| 41 | unset($this->repository[$carId]); |
|
| 42 | ||
| 43 | return 0; |
|
| 44 | } |
|
| 45 | ||
| 46 | public function getAllPositions() |
|