Total Complexity | 7 |
Total Lines | 40 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
8 | class GeoDataImporter |
||
9 | { |
||
10 | protected FilesystemStorage $storage; |
||
11 | |||
12 | 4 | public function __construct(Container $app) |
|
15 | 4 | } |
|
16 | |||
17 | 4 | public function storeFileFromUrl(string $url, ?string $name, ?\Closure $progressCallback = null, bool $force = false): bool |
|
18 | { |
||
19 | 4 | if (!($exists = $this->storage->exists($name)) || $force) { |
|
|
|||
20 | 3 | if ($exists) { |
|
21 | 1 | $this->storage->delete($name); |
|
22 | } |
||
23 | |||
24 | 3 | return $this->storage->storeFromUrl($url, $name, $progressCallback); |
|
25 | } |
||
26 | |||
27 | 2 | return false; |
|
28 | } |
||
29 | |||
30 | /** |
||
31 | * @param string $file |
||
32 | * |
||
33 | * @return bool |
||
34 | * @throws \Exception |
||
35 | */ |
||
36 | 1 | public function extractFile(string $file): bool |
|
37 | { |
||
38 | 1 | return $this->storage->extractZipFile($file); |
|
39 | } |
||
40 | |||
41 | /** |
||
42 | * @return bool |
||
43 | * @throws \Exception |
||
44 | */ |
||
45 | 4 | public function truncateStorage(): bool |
|
48 | } |
||
49 | } |
||
50 |