| 1 | <?php |
||
| 5 | class Legislature |
||
| 6 | { |
||
| 7 | public $name; |
||
| 8 | public $slug; |
||
| 9 | public $personCount; |
||
| 10 | public $sha; |
||
| 11 | public $statementCount; |
||
| 12 | public $popoloUrl; |
||
| 13 | protected $legislatureData; |
||
| 14 | protected $country; |
||
| 15 | |||
| 16 | 18 | public function __construct($legislatureData, $country) |
|
| 34 | |||
| 35 | 3 | public function __toString() |
|
| 39 | |||
| 40 | /** |
||
| 41 | * Return the directory path in the everypolitician-data repository |
||
| 42 | */ |
||
| 43 | 3 | public function directory() |
|
| 49 | } |
||
| 50 |
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: