1 | <?php |
||
10 | abstract class AbstractStorage implements Storage |
||
11 | { |
||
12 | /** |
||
13 | * @var AbstractStorage|null |
||
14 | */ |
||
15 | protected $successor; |
||
16 | |||
17 | /** |
||
18 | * @var bool |
||
19 | */ |
||
20 | protected $isAvailable = false; |
||
21 | |||
22 | /** |
||
23 | * @param bool $isAvailable |
||
24 | */ |
||
25 | 3 | public function setIsAvailable(bool $isAvailable): void |
|
29 | |||
30 | /** |
||
31 | * @param AbstractStorage $storage |
||
32 | */ |
||
33 | 3 | public function setNext(AbstractStorage $storage) |
|
37 | |||
38 | /** |
||
39 | * @param int $id |
||
40 | * @return string |
||
41 | */ |
||
42 | abstract protected function findProductById(int $id): string ; |
||
43 | |||
44 | /** |
||
45 | * @return bool |
||
46 | */ |
||
47 | 3 | protected function isAvailable(): bool |
|
51 | |||
52 | /** |
||
53 | * @param int $id |
||
54 | * @return string |
||
55 | * @throws \Exception |
||
56 | */ |
||
57 | 3 | public function find(int $id): string |
|
69 | } |
||
70 |