| 1 | <?php namespace BuildR\Collection\Collection; |
||
| 20 | trait FilterableCollectionTrait { |
||
| 21 | |||
| 22 | /** |
||
| 23 | * Returns a new list that only contains the element which the filter is returned. |
||
| 24 | * The filter is accept any callable type. |
||
| 25 | * |
||
| 26 | * The callable takes two argument, the first is the key and the second is the |
||
| 27 | * value of the element. |
||
| 28 | * |
||
| 29 | * @param callable $filter |
||
| 30 | * |
||
| 31 | * @return \BuildR\Collection\ArrayList\ListInterface |
||
| 32 | */ |
||
| 33 | public function filter(callable $filter) { |
||
| 38 | |||
| 39 | } |
||
| 40 |
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: