1 | <?php |
||
20 | trait Enumerable{ |
||
21 | |||
22 | /** |
||
23 | * @var array |
||
24 | */ |
||
25 | protected $array = []; |
||
26 | |||
27 | /** |
||
28 | * @var int |
||
29 | */ |
||
30 | protected $offset = 0; |
||
31 | |||
32 | /************* |
||
33 | * prototype * |
||
34 | *************/ |
||
35 | |||
36 | /** |
||
37 | * @link http://api.prototypejs.org/language/Enumerable/prototype/toArray/ |
||
38 | * |
||
39 | * @return array |
||
40 | */ |
||
41 | public function __toArray():array { |
||
44 | |||
45 | /** |
||
46 | * @link http://api.prototypejs.org/language/Enumerable/prototype/each/ |
||
47 | * |
||
48 | * @param callable $callback |
||
49 | * |
||
50 | * @return $this |
||
51 | */ |
||
52 | public function __each($callback){ |
||
57 | |||
58 | /** |
||
59 | * @link http://api.prototypejs.org/language/Enumerable/prototype/collect/ |
||
60 | * @link http://api.prototypejs.org/language/Enumerable/prototype/map/ |
||
61 | * |
||
62 | * @param callable $callback |
||
63 | * |
||
64 | * @return array |
||
65 | * @throws \Exception |
||
66 | */ |
||
67 | public function __map($callback):array { |
||
81 | |||
82 | /** |
||
83 | * @link http://api.prototypejs.org/language/Enumerable/prototype/pluck/ |
||
84 | * |
||
85 | * @param string $property |
||
86 | * |
||
87 | * @return array |
||
88 | */ |
||
89 | public function __pluck(string $property):array { |
||
92 | |||
93 | /** |
||
94 | * @link http://api.prototypejs.org/language/Array/prototype/reverse/ |
||
95 | * |
||
96 | * @return $this |
||
97 | */ |
||
98 | public function __reverse(){ |
||
104 | |||
105 | |||
106 | } |
||
107 |