| 1 | <?php |
||
| 5 | class ComponentClass |
||
| 6 | { |
||
| 7 | |||
| 8 | protected $class; |
||
| 9 | protected $baseType; |
||
| 10 | protected $functionalType; |
||
| 11 | protected $hierarchy; |
||
| 12 | |||
| 13 | public function __construct($class, $baseType, $functionalType, array $hierarchy) |
||
| 20 | |||
| 21 | /** |
||
| 22 | * @return mixed |
||
| 23 | */ |
||
| 24 | public function getClass() |
||
| 28 | |||
| 29 | /** |
||
| 30 | * @return mixed |
||
| 31 | */ |
||
| 32 | public function getBaseType() |
||
| 36 | |||
| 37 | /** |
||
| 38 | * @return mixed |
||
| 39 | */ |
||
| 40 | public function getFunctionalType() |
||
| 44 | |||
| 45 | /** |
||
| 46 | * @return array |
||
| 47 | */ |
||
| 48 | public function getHierarchy() |
||
| 52 | |||
| 53 | |||
| 54 | } |
||
| 55 |
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: