Completed
Push — master ( 35413c...f854d5 )
by Sebastian
21:09
created

Abstraction   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 107
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 86.67%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 7
lcom 0
cbo 0
dl 0
loc 107
ccs 13
cts 15
cp 0.8667
rs 10
c 1
b 0
f 0

7 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getCommand() 0 4 1
A getAcceptableExitCodes() 0 4 1
A getPath() 0 4 1
A getSuffix() 0 4 1
A isPipeable() 0 4 1
A getMimeType() 0 4 1
1
<?php
2
namespace phpbu\App\Backup\Target\Compression;
3
4
use phpbu\App\Backup\Target\Compression;
5
6
/**
7
 * Abstraction
8
 *
9
 * @package    phpbu
10
 * @subpackage Backup
11
 * @author     Sebastian Feldmann <[email protected]>
12
 * @copyright  Sebastian Feldmann <[email protected]>
13
 * @license    https://opensource.org/licenses/MIT The MIT License (MIT)
14
 * @link       http://phpbu.de/
15
 * @since      Class available since Release 3.2.1
16
 */
17
abstract class Abstraction implements Compression
18
{
19
    /**
20
     * Command name
21
     *
22
     * @var string
23
     */
24
    protected $cmd;
25
26
    /**
27
     * Path to command binary
28
     *
29
     * @var string
30
     */
31
    protected $path;
32
33
    /**
34
     * Suffix for compressed files
35
     *
36
     * @var string
37
     */
38
    protected $suffix;
39
40
    /**
41
     * MIME type for compressed files
42
     *
43
     * @var string
44
     */
45
    protected $mimeType;
46
47
    /**
48
     * Can this compression compress piped output
49
     *
50
     * @var bool
51
     */
52
    protected $pipeable;
53
54
    /**
55
     * Constructor.
56
     *
57
     * @param string $path
58
     */
59 19
    public function __construct(string $path = '')
60
    {
61 19
        $this->path = $path;
62 19
    }
63
64
    /**
65
     * Return the cli command.
66
     *
67
     * @return string
68
     */
69 9
    public function getCommand() : string
70
    {
71 9
        return $this->cmd;
72
    }
73
74
    /**
75
     * Return a list of acceptable exit codes.
76
     *
77
     * @return int[]
78
     */
79
    public function getAcceptableExitCodes(): array
80
    {
81
        return [0];
82
    }
83
84
    /**
85
     * Path getter.
86
     *
87
     * @return string
88
     */
89 1
    public function getPath() : string
90
    {
91 1
        return $this->path;
92
    }
93
94
    /**
95
     * Returns the compressor suffix e.g. 'bz2'.
96
     *
97
     * @return string
98
     */
99 6
    public function getSuffix() : string
100
    {
101 6
        return $this->suffix;
102
    }
103
104
    /**
105
     * Is the compression app pipeable.
106
     *
107
     * @return bool
108
     */
109 1
    public function isPipeable() : bool
110
    {
111 1
        return $this->pipeable;
112
    }
113
114
    /**
115
     * Returns the compressor mime type.
116
     *
117
     * @return string
118
     */
119 4
    public function getMimeType() : string
120
    {
121 4
        return $this->mimeType;
122
    }
123
}
124