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