| 1 | <?php |
||
| 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 | 13 | public function __construct(string $path = '') |
|
| 63 | |||
| 64 | /** |
||
| 65 | * Return the cli command. |
||
| 66 | * |
||
| 67 | * @return string |
||
| 68 | */ |
||
| 69 | 9 | public function getCommand() : string |
|
| 73 | |||
| 74 | /** |
||
| 75 | * Return a list of acceptable exit codes. |
||
| 76 | * |
||
| 77 | * @return int[] |
||
| 78 | */ |
||
| 79 | 1 | public function getAcceptableExitCodes(): array |
|
| 80 | { |
||
| 81 | 1 | return [0]; |
|
| 82 | } |
||
| 83 | |||
| 84 | /** |
||
| 85 | * Path getter. |
||
| 86 | * |
||
| 87 | * @return string |
||
| 88 | */ |
||
| 89 | 1 | public function getPath() : string |
|
| 93 | |||
| 94 | /** |
||
| 95 | * Returns the compressor suffix e.g. 'bz2'. |
||
| 96 | * |
||
| 97 | * @return string |
||
| 98 | */ |
||
| 99 | 7 | public function getSuffix() : string |
|
| 103 | |||
| 104 | /** |
||
| 105 | * Is the compression app pipeable. |
||
| 106 | * |
||
| 107 | * @return bool |
||
| 108 | */ |
||
| 109 | 1 | public function isPipeable() : bool |
|
| 113 | |||
| 114 | /** |
||
| 115 | * Returns the compressor mime type. |
||
| 116 | * |
||
| 117 | * @return string |
||
| 118 | */ |
||
| 119 | 4 | public function getMimeType() : string |
|
| 123 | } |
||
| 124 |