| 1 | <?php |
||
| 5 | class DsnParser |
||
| 6 | { |
||
| 7 | /** |
||
| 8 | * @param $dsnString |
||
| 9 | */ |
||
| 10 | public function __construct($dsnString) |
||
| 14 | |||
| 15 | /** |
||
| 16 | * @return string |
||
| 17 | */ |
||
| 18 | public function getPort() |
||
| 22 | |||
| 23 | /** |
||
| 24 | * @return string |
||
| 25 | */ |
||
| 26 | public function getHost() |
||
| 30 | |||
| 31 | /** |
||
| 32 | * @return array |
||
| 33 | */ |
||
| 34 | protected function getDsnParts() |
||
| 51 | } |
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: