1 | <?php |
||
11 | trait MapByTrait |
||
12 | { |
||
13 | /** |
||
14 | * Make an iterator returning values from this iterable and keys |
||
15 | * from $strategy. |
||
16 | * |
||
17 | * When $strategy is a string, the key is obtained through one of |
||
18 | * the following: |
||
19 | * 1. $value->{$strategy}, when $value is an object and |
||
20 | * $strategy is an existing property, |
||
21 | * 2. call $value->{$strategy}(), when $value is an object and |
||
22 | * $strategy is an existing method, |
||
23 | * 3. $value[$strategy], when $value is an array and $strategy |
||
24 | * is an existing key, |
||
25 | * 4. otherwise the key will default to null. |
||
26 | * |
||
27 | * Alternatively $strategy can be a closure. In this case the |
||
28 | * $strategy closure is called with each value in $iterable and the |
||
29 | * key will be its return value. |
||
30 | * |
||
31 | * > $list = [['id'=>1, 'title'=>'one'], ['id'=>2, 'title'=>'two']] |
||
32 | * > iter\iterable($list)->mapBy('id') |
||
33 | * 1=>['id'=>1, 'title'=>'one'] 2=>['id'=>2, 'title'=>'two'] |
||
34 | * |
||
35 | * @param null|string|\Closure $strategy |
||
36 | * @return MapByIterator |
||
37 | */ |
||
38 | 25 | public function mapBy($strategy) |
|
49 | } |
||
50 |
This function has been deprecated. The supplier of the file has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the function will be removed from the class and what other function to use instead.