1 | <?php |
||
46 | class CachePreserver implements EveApiPreserverInterface |
||
47 | { |
||
48 | use SafeFileHandlingTrait; |
||
49 | use EveApiEventEmitterTrait; |
||
50 | /** |
||
51 | * @param string $cachePath |
||
52 | * @param bool $preserve |
||
53 | */ |
||
54 | 8 | public function __construct(string $cachePath, bool $preserve = false) |
|
59 | /** |
||
60 | * @param EveApiEventInterface $event |
||
61 | * @param string $eventName |
||
62 | * @param MediatorInterface $yem |
||
63 | * |
||
64 | * @return EveApiEventInterface |
||
65 | * @throws \DomainException |
||
66 | * @throws \InvalidArgumentException |
||
67 | * @throws \LogicException |
||
68 | * @throws \UnexpectedValueException |
||
69 | */ |
||
70 | 6 | public function preserveEveApi( |
|
97 | /** |
||
98 | * @param string $value |
||
99 | * |
||
100 | * @return self Fluent interface. |
||
101 | */ |
||
102 | 8 | public function setCachePath(string $value): self |
|
107 | /** |
||
108 | * Turn on or off preserving of Eve API data by this preserver. |
||
109 | * |
||
110 | * Allows class to stay registered for events but be enabled or disabled during runtime. |
||
111 | * |
||
112 | * @param bool $value |
||
113 | * |
||
114 | * @return self Fluent interface. |
||
115 | */ |
||
116 | 8 | public function setPreserve(bool $value = true): self |
|
121 | /** |
||
122 | * @return string |
||
123 | * @throws \LogicException |
||
124 | */ |
||
125 | 5 | protected function getCachePath() |
|
133 | /** |
||
134 | * @return bool |
||
135 | */ |
||
136 | 6 | private function shouldPreserve() |
|
140 | /** |
||
141 | * @var string $cachePath |
||
142 | */ |
||
143 | private $cachePath; |
||
144 | /** |
||
145 | * @var bool $preserve |
||
146 | */ |
||
147 | private $preserve = false; |
||
148 | } |
||
149 |