| Conditions | 5 |
| Paths | 5 |
| Total Lines | 20 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 48 | protected function getOption(string $name, $default = null) |
||
| 49 | { |
||
| 50 | if (!$this->hasOption($name)) { |
||
| 51 | return $default; |
||
| 52 | } |
||
| 53 | |||
| 54 | if (array_key_exists($name, $this->options)) { |
||
| 55 | return $this->options[$name]; |
||
| 56 | } |
||
| 57 | |||
| 58 | if (!isset($this->aliases[$name])) { |
||
| 59 | return false; |
||
| 60 | } |
||
| 61 | |||
| 62 | foreach ($this->aliases[$name] as $name) { |
||
| 63 | return $this->hasOption($name); |
||
| 64 | } |
||
| 65 | |||
| 66 | return false; |
||
| 67 | } |
||
| 68 | } |
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: