| 1 | <?php |
||
| 11 | trait OperationsTrait |
||
| 12 | { |
||
| 13 | |||
| 14 | /** |
||
| 15 | * Returns the number of parameters. |
||
| 16 | * |
||
| 17 | * @return int The number of parameters |
||
| 18 | */ |
||
| 19 | 3 | public function count() |
|
| 23 | |||
| 24 | /** |
||
| 25 | * Returns number of items in $collection. |
||
| 26 | * |
||
| 27 | * @return int |
||
| 28 | */ |
||
| 29 | public function size() |
||
| 38 | |||
| 39 | /** |
||
| 40 | * @return bool |
||
| 41 | */ |
||
| 42 | public function isEmpty() |
||
| 46 | |||
| 47 | /** |
||
| 48 | * @return bool |
||
| 49 | */ |
||
| 50 | public function isNotEmpty() |
||
| 54 | |||
| 55 | /** |
||
| 56 | * @return $this |
||
| 57 | */ |
||
| 58 | 1 | public function clear() |
|
| 65 | |||
| 66 | /** |
||
| 67 | * @return void |
||
| 68 | */ |
||
| 69 | abstract public function rewind(); |
||
| 70 | } |
||
| 71 |
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: