1 | <?php |
||
25 | class NumericCollection extends AbstractCollection |
||
26 | { |
||
27 | /** |
||
28 | * {@inheritdoc} |
||
29 | */ |
||
30 | protected function prepareData($data) |
||
34 | |||
35 | /** |
||
36 | * Increment an item. |
||
37 | * |
||
38 | * Increment the item specified by $key by one value. Intended for integers |
||
39 | * but also works (using this term loosely) for letters. Any other data type |
||
40 | * it may modify is unintended behavior at best. |
||
41 | * |
||
42 | * This method modifies its internal data array rather than returning a new |
||
43 | * collection. |
||
44 | * |
||
45 | * @param mixed $key The key of the item you want to increment. |
||
46 | * @param int $interval The interval that $key should be incremented by |
||
47 | * |
||
48 | * @return $this |
||
49 | */ |
||
50 | public function increment($key, $interval = 1) |
||
60 | |||
61 | /** |
||
62 | * Decrement an item. |
||
63 | * |
||
64 | * Frcrement the item specified by $key by one value. Intended for integers. |
||
65 | * Does not work for letters and if it does anything to anything else, it's |
||
66 | * unintended at best. |
||
67 | * |
||
68 | * This method modifies its internal data array rather than returning a new |
||
69 | * collection. |
||
70 | * |
||
71 | * @param mixed $key The key of the item you want to decrement. |
||
72 | * @param int $interval The interval that $key should be decremented by |
||
73 | * |
||
74 | * @return $this |
||
75 | */ |
||
76 | public function decrement($key, $interval = 1) |
||
86 | |||
87 | /** |
||
88 | * Get the sum. |
||
89 | * |
||
90 | * @return mixed The sum of all values in collection |
||
|
|||
91 | */ |
||
92 | public function sum() |
||
96 | |||
97 | /** |
||
98 | * Get the average. |
||
99 | * |
||
100 | * @return float|int The average value from the collection |
||
101 | */ |
||
102 | public function average() |
||
106 | |||
107 | /** |
||
108 | * Get the mode. |
||
109 | * |
||
110 | * @return float|int The mode |
||
111 | */ |
||
112 | public function mode() |
||
120 | |||
121 | /** |
||
122 | * Get the median value. |
||
123 | * |
||
124 | * @return float|int The median value |
||
125 | */ |
||
126 | public function median() |
||
143 | |||
144 | /** |
||
145 | * Get the maximum value. |
||
146 | * |
||
147 | * @return mixed The maximum |
||
148 | */ |
||
149 | public function max() |
||
153 | |||
154 | /** |
||
155 | * Get the minimum value. |
||
156 | * |
||
157 | * @return mixed The minimum |
||
158 | */ |
||
159 | public function min() |
||
163 | |||
164 | /** |
||
165 | * Get the number of times each item occurs in the collection. |
||
166 | * |
||
167 | * This method will return a NumericCollection where keys are the |
||
168 | * values and values are the number of times that value occurs in |
||
169 | * the original collection. |
||
170 | * |
||
171 | * @return NumericCollection |
||
172 | */ |
||
173 | public function counts() |
||
177 | |||
178 | protected function isConsistentDataStructure($data) |
||
191 | } |
||
192 |
This check looks for the generic type
array
as a return type and suggests a more specific type. This type is inferred from the actual code.