Test Setup Failed
Push — develop ( 04b246...d52f7e )
by Nikita
10:40
created

Archiver   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 2
eloc 8
c 1
b 0
f 1
dl 0
loc 19
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A extractTarGzip() 0 12 2
1
<?php
2
3
namespace Gameap\Adapters;
4
5
use splitbrain\PHPArchive\Tar;
6
7
class Archiver
8
{
9
    /**
10
     * @throws \splitbrain\PHPArchive\ArchiveCorruptedException
11
     * @throws \splitbrain\PHPArchive\ArchiveIOException
12
     * @throws \splitbrain\PHPArchive\ArchiveIllegalCompressionException
13
     */
14
    public function extractTarGzip(string $path, string $destination, int $strip = 0): array
15
    {
16
        $tar = new Tar();
17
        $tar->open($path);
18
        $contents = $tar->extract($destination, $strip);
19
20
        $fileList = [];
21
        foreach ($contents as $file) {
22
            $fileList[] = $file->getPath();
23
        }
24
25
        return $fileList;
26
    }
27
}
28