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