1 | <?php |
||
15 | abstract class AbstractCompressor implements CompressorInterface, DeCompressorInterface, LoggerAwareInterface, ProcessFactoryAwareInterface |
||
16 | { |
||
17 | use OptionalLoggerTrait; |
||
18 | use FileProcessTrait; |
||
19 | use GetOptionTrait; |
||
20 | |||
21 | /** |
||
22 | * Compress a file and return the new file |
||
23 | * |
||
24 | * @param FileNodeInterface $node |
||
25 | * @param array $options |
||
26 | * |
||
27 | * @return FileNodeInterface |
||
28 | */ |
||
29 | 20 | public function compress(FileNodeInterface $node, array $options = []) |
|
56 | |||
57 | /** |
||
58 | * Decompress a file and return the decompressed file |
||
59 | * |
||
60 | * @param FileNodeInterface $node |
||
61 | * @param array $options |
||
62 | * |
||
63 | * @return FileNodeInterface |
||
64 | */ |
||
65 | 18 | public function decompress(FileNodeInterface $node, array $options = []) |
|
92 | |||
93 | /** |
||
94 | * Get the extension used by this compressor |
||
95 | * |
||
96 | * @return string |
||
97 | */ |
||
98 | abstract protected function getExtension(); |
||
99 | |||
100 | /** |
||
101 | * @return string |
||
102 | */ |
||
103 | abstract protected function getCompression(); |
||
104 | |||
105 | /** |
||
106 | * Get the command line to compress a file |
||
107 | * |
||
108 | * @param string $fromPath |
||
109 | * @param string $toPath |
||
110 | * |
||
111 | * @return string |
||
112 | */ |
||
113 | abstract protected function getCompressCommand($fromPath, $toPath); |
||
114 | |||
115 | /** |
||
116 | * Get the command line to decompress a file |
||
117 | * |
||
118 | * @param string $fromPath |
||
119 | * @param string $toPath |
||
120 | * |
||
121 | * @return string |
||
122 | */ |
||
123 | abstract protected function getDecompressCommand($fromPath, $toPath); |
||
124 | } |
||
125 |