1 | <?php |
||
5 | abstract class Compressor |
||
6 | { |
||
7 | /* @string compression level*/ |
||
8 | protected $level = null; |
||
9 | |||
10 | abstract public function getCompressorCommand(); |
||
11 | |||
12 | /** |
||
13 | * get the extension of the compressed file. |
||
14 | * |
||
15 | * @returns string |
||
16 | */ |
||
17 | public function getExtension() |
||
21 | |||
22 | /** |
||
23 | * Set compression level. |
||
24 | * |
||
25 | * @param string $level |
||
26 | */ |
||
27 | public function setLevel(string $level) |
||
31 | } |
||
32 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: