Conditions | 6 |
Paths | 6 |
Total Lines | 25 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
39 | public function isAlreadyExtracted($path) |
||
40 | { |
||
41 | try { |
||
42 | /** @var File[] $archiveContent */ |
||
43 | $archiveContent = (new UnzipCommandDecoder())->getFiles($this->archiveFile); |
||
44 | } catch (\Exception $e) { |
||
45 | return 3; |
||
46 | } |
||
47 | |||
48 | foreach ($archiveContent as $file) { |
||
49 | if ($file->isDir()) { |
||
50 | continue; |
||
51 | } |
||
52 | |||
53 | if (!$this->fs->exists($path . $file->getPath())) { |
||
54 | return 2; |
||
55 | } |
||
56 | |||
57 | if (filesize($path . $file->getPath()) != $file->getUnpackedSize()) { |
||
58 | return 1; |
||
59 | } |
||
60 | } |
||
61 | |||
62 | return 0; |
||
63 | } |
||
64 | } |
||
65 |