1 | <?php |
||
7 | abstract class Parser |
||
8 | { |
||
9 | /** |
||
10 | * Command to build. |
||
11 | * |
||
12 | * @var Command |
||
13 | */ |
||
14 | protected $command; |
||
15 | |||
16 | /** |
||
17 | * Construct. |
||
18 | * |
||
19 | * @param Command $command |
||
20 | */ |
||
21 | public function __construct(Command $command) |
||
25 | |||
26 | /** |
||
27 | * Set array modeArray value if value contains *. |
||
28 | * |
||
29 | * @param string $value |
||
30 | * @param string $constant |
||
31 | * |
||
32 | * @return string |
||
33 | */ |
||
34 | protected function parseArray($value, $constant) |
||
44 | |||
45 | /** |
||
46 | * Parse an argument/option description. |
||
47 | * |
||
48 | * @param string $value |
||
49 | * |
||
50 | * @return array [argument|option, description] |
||
51 | */ |
||
52 | protected function parseDescription($value) |
||
60 | |||
61 | /** |
||
62 | * Calculate the mode score. |
||
63 | * |
||
64 | * @param array $modeArray |
||
65 | * @param string $class |
||
66 | * |
||
67 | * @return int |
||
68 | */ |
||
69 | protected function calculateMode(array $modeArray, $class) |
||
79 | } |
||
80 |
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: