| 1 | <?php |
||
| 5 | class ConnectionConfig implements ConnectionConfigInterface |
||
| 6 | { |
||
| 7 | private $adapter; |
||
| 8 | private $username; |
||
| 9 | private $password; |
||
| 10 | |||
| 11 | /** |
||
| 12 | * Constructor. |
||
| 13 | * |
||
| 14 | * @param array $config Array config. |
||
| 15 | */ |
||
| 16 | public function __construct(array $config = array()) |
||
| 20 | |||
| 21 | /** |
||
| 22 | * {@inheritdoc} |
||
| 23 | */ |
||
| 24 | public function changeEnvironment($environment) |
||
| 28 | |||
| 29 | /** |
||
| 30 | * {@inheritdoc} |
||
| 31 | */ |
||
| 32 | public function getUsername() |
||
| 36 | |||
| 37 | /** |
||
| 38 | * {@inheritdoc} |
||
| 39 | */ |
||
| 40 | public function getPassword() |
||
| 44 | |||
| 45 | /** |
||
| 46 | * {@inheritdoc} |
||
| 47 | */ |
||
| 48 | public function getDsn() |
||
| 52 | |||
| 53 | /** |
||
| 54 | * Get database adapter. |
||
| 55 | * |
||
| 56 | * @return string |
||
| 57 | */ |
||
| 58 | public function getAdapter() |
||
| 62 | |||
| 63 | /** |
||
| 64 | * Parse configuration. |
||
| 65 | * |
||
| 66 | * @param array $config |
||
| 67 | * @return void |
||
| 68 | */ |
||
| 69 | private function parseConfiguration(array $config) |
||
| 87 | } |
||
| 88 |
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: