| 1 | <?php |
||
| 11 | trait OperationsTrait |
||
| 12 | { |
||
| 13 | |||
| 14 | /** |
||
| 15 | * Returns the number of parameters. |
||
| 16 | * |
||
| 17 | * @return int The number of parameters |
||
| 18 | */ |
||
| 19 | 2 | public function count() |
|
| 23 | |||
| 24 | /** |
||
| 25 | * Returns number of items in $collection. |
||
| 26 | * |
||
| 27 | * @return int |
||
| 28 | */ |
||
| 29 | public function size() |
||
| 37 | |||
| 38 | /** |
||
| 39 | * @return bool |
||
| 40 | */ |
||
| 41 | public function isEmpty() |
||
| 45 | |||
| 46 | /** |
||
| 47 | * @return bool |
||
| 48 | */ |
||
| 49 | public function isNotEmpty() |
||
| 53 | |||
| 54 | /** |
||
| 55 | * @return $this |
||
| 56 | */ |
||
| 57 | public function clear() |
||
| 64 | } |
||
| 65 |
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: