Passed
Push — master ( bcbcca...8fb468 )
by Guillaume
08:29
created

DocsetArchiver   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
eloc 13
dl 0
loc 25
ccs 12
cts 12
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A archive() 0 15 1
A __construct() 0 3 1
1
<?php
2
3
namespace Godbout\DashDocsetBuilder\Services;
4
5
use Godbout\DashDocsetBuilder\Contracts\Docset;
6
7
final class DocsetArchiver
8
{
9
    public $docset;
10
11
12 18
    public function __construct(Docset $docset)
13
    {
14 18
        $this->docset = $docset;
15 18
    }
16
17 12
    public function archive()
18
    {
19 12
        $archiveDirectory = "storage/{$this->docset->code()}";
20
21 12
        system(
22 8
            "tar \
23
            --exclude='.DS_Store' \
24
            -czf \
25 12
            $archiveDirectory/{$this->docset->code()}.tgz \
26 12
            -C $archiveDirectory \
27 12
            {$this->docset->code()}.docset",
28 4
            $result
29
        );
30
31 12
        return $result === 0;
32
    }
33
}
34