| 1 | <?php |
||
| 9 | trait OperationsTrait |
||
| 10 | { |
||
| 11 | |||
| 12 | /** |
||
| 13 | * Returns the number of parameters. |
||
| 14 | * |
||
| 15 | * @return int The number of parameters |
||
| 16 | */ |
||
| 17 | 4 | public function count() |
|
| 21 | |||
| 22 | /** |
||
| 23 | * Returns number of items in $collection. |
||
| 24 | * |
||
| 25 | * @return int |
||
| 26 | */ |
||
| 27 | public function size() |
||
| 36 | |||
| 37 | /** |
||
| 38 | * @return bool |
||
| 39 | */ |
||
| 40 | public function isEmpty() |
||
| 44 | |||
| 45 | /** |
||
| 46 | * @return bool |
||
| 47 | */ |
||
| 48 | public function isNotEmpty() |
||
| 52 | |||
| 53 | /** |
||
| 54 | * @return $this |
||
| 55 | */ |
||
| 56 | 1 | public function clear() |
|
| 63 | |||
| 64 | /** |
||
| 65 | * Key an associative array by a field or using a callback. |
||
| 66 | * |
||
| 67 | * @param callable|string $keyBy |
||
| 68 | * @return static |
||
| 69 | */ |
||
| 70 | 1 | public function keyBy($keyBy) |
|
| 79 | |||
| 80 | /** |
||
| 81 | * @return void |
||
| 82 | */ |
||
| 83 | abstract public function rewind(); |
||
| 84 | } |
||
| 85 |
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: