@@ 175-186 (lines=12) @@ | ||
172 | * @throws StorageException |
|
173 | * @throws \ReflectionException |
|
174 | */ |
|
175 | private function findDataDirectory(): string |
|
176 | { |
|
177 | $dataDirectory = $this->options['dataDirectory']; |
|
178 | if($this->options['dataDirectory'] === 'auto') { |
|
179 | $reflection = new \ReflectionClass(AbstractData::class); |
|
180 | $dataDirectory = sprintf('%s/var/%s', dirname($reflection->getFileName(),3), $this->options['format']); |
|
181 | } |
|
182 | if(is_dir($dataDirectory)){ |
|
183 | return $dataDirectory; |
|
184 | } |
|
185 | throw new StorageException(sprintf(StorageException::DIRECTORY_NOT_FOUND, $dataDirectory)); |
|
186 | } |
|
187 | ||
188 | /** |
|
189 | * @return string |
|
@@ 193-204 (lines=12) @@ | ||
190 | * @throws StorageException |
|
191 | * @throws \ReflectionException |
|
192 | */ |
|
193 | private function findCacheDirectory(): string |
|
194 | { |
|
195 | $cacheDirectory = $this->options['cacheDirectory']; |
|
196 | if($this->options['cacheDirectory'] === 'auto') { |
|
197 | $reflection = new \ReflectionClass(AbstractData::class); |
|
198 | $cacheDirectory = sprintf('%s/var/cache', dirname($reflection->getFileName(),3)); |
|
199 | } |
|
200 | if(is_dir($cacheDirectory)){ |
|
201 | return $cacheDirectory; |
|
202 | } |
|
203 | throw new StorageException(sprintf(StorageException::DIRECTORY_NOT_FOUND, $cacheDirectory)); |
|
204 | } |
|
205 | } |