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