1 | <?php |
||
24 | class InMemoryRobotStore implements RobotStoreInterface |
||
25 | { |
||
26 | private static $store; |
||
27 | |||
28 | private $logger; |
||
29 | |||
30 | private $robot; |
||
31 | |||
32 | /** |
||
33 | * __construct. |
||
34 | * |
||
35 | * @param LoggerInterface|null $logger |
||
36 | */ |
||
37 | 1 | private function __construct(?LoggerInterface $logger = null) |
|
41 | |||
42 | /** |
||
43 | * @param LoggerInterface|null $logger |
||
44 | * |
||
45 | * @return RobotStoreInterface |
||
46 | */ |
||
47 | 4 | public static function getStore(?LoggerInterface $logger = null): RobotStoreInterface |
|
56 | |||
57 | /** |
||
58 | * @param LoggerInterface|null $logger |
||
59 | * |
||
60 | * @return RobotStoreInterface |
||
61 | */ |
||
62 | 1 | private static function createStore(?LoggerInterface $logger): RobotStoreInterface |
|
66 | |||
67 | /** |
||
68 | * @return Robot|null |
||
69 | */ |
||
70 | 2 | public function getRobot(): ?Robot |
|
74 | |||
75 | /** |
||
76 | * @param Robot $robot |
||
77 | */ |
||
78 | 2 | public function saveRobot(Robot $robot): void |
|
83 | |||
84 | /** |
||
85 | * @param string $msg |
||
86 | */ |
||
87 | 2 | private function log(string $msg): void |
|
95 | } |
||
96 |