| Conditions | 6 |
| Paths | 6 |
| Total Lines | 27 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 54 | public function isAlreadyExtracted($path) |
||
| 55 | { |
||
| 56 | try { |
||
| 57 | /** @var File[] $archiveContent */ |
||
| 58 | $archiveContent = (new UnrarCommandDecoder())->getFiles($this->archiveFile); |
||
| 59 | } catch (\Exception $e) { |
||
| 60 | return 3; |
||
| 61 | } |
||
| 62 | |||
| 63 | foreach ($archiveContent as $file) { |
||
| 64 | if ($file->isDir()) { |
||
| 65 | continue; |
||
| 66 | } |
||
| 67 | |||
| 68 | if (!$this->fs->exists($path . $file->getPath())) { |
||
| 69 | return 2; |
||
| 70 | } |
||
| 71 | |||
| 72 | |||
| 73 | |||
| 74 | if (filesize($path . $file->getPath()) != $file->getUnpackedSize()) { |
||
| 75 | return 1; |
||
| 76 | } |
||
| 77 | } |
||
| 78 | |||
| 79 | return 0; |
||
| 80 | } |
||
| 81 | } |
||
| 82 |