1 | <?php |
||
26 | class NumericCollection extends AbstractCollection |
||
27 | { |
||
28 | /** |
||
29 | * Increment an item. |
||
30 | * |
||
31 | * Increment the item specified by $key by one value. Intended for integers |
||
32 | * but also works (using this term loosely) for letters. Any other data type |
||
33 | * it may modify is unintended behavior at best. |
||
34 | * |
||
35 | * This method modifies its internal data array rather than returning a new |
||
36 | * collection. |
||
37 | * |
||
38 | * @param mixed $key The key of the item you want to increment. |
||
39 | * @param int $interval The interval that $key should be incremented by |
||
40 | * |
||
41 | * @return $this |
||
42 | */ |
||
43 | public function increment($key, $interval = 1) |
||
53 | |||
54 | /** |
||
55 | * Decrement an item. |
||
56 | * |
||
57 | * Frcrement the item specified by $key by one value. Intended for integers. |
||
58 | * Does not work for letters and if it does anything to anything else, it's |
||
59 | * unintended at best. |
||
60 | * |
||
61 | * This method modifies its internal data array rather than returning a new |
||
62 | * collection. |
||
63 | * |
||
64 | * @param mixed $key The key of the item you want to decrement. |
||
65 | * @param int $interval The interval that $key should be decremented by |
||
66 | * |
||
67 | * @return $this |
||
68 | */ |
||
69 | public function decrement($key, $interval = 1) |
||
79 | |||
80 | /** |
||
81 | * Get the sum. |
||
82 | * |
||
83 | * @return mixed The sum of all values in collection |
||
84 | */ |
||
85 | public function sum() |
||
89 | |||
90 | /** |
||
91 | * Get the average. |
||
92 | * |
||
93 | * @return float|int The average value from the collection |
||
94 | */ |
||
95 | public function average() |
||
99 | |||
100 | /** |
||
101 | * Get the mode. |
||
102 | * |
||
103 | * @return float|int The mode |
||
104 | */ |
||
105 | public function mode() |
||
113 | |||
114 | /** |
||
115 | * Get the median value. |
||
116 | * |
||
117 | * @return float|int The median value |
||
118 | */ |
||
119 | public function median() |
||
136 | |||
137 | /** |
||
138 | * Get the maximum value. |
||
139 | * |
||
140 | * @return mixed The maximum |
||
141 | */ |
||
142 | public function max() |
||
146 | |||
147 | /** |
||
148 | * Get the minimum value. |
||
149 | * |
||
150 | * @return mixed The minimum |
||
151 | */ |
||
152 | public function min() |
||
156 | |||
157 | /** |
||
158 | * Get the number of times each item occurs in the collection. |
||
159 | * |
||
160 | * This method will return a NumericCollection where keys are the |
||
161 | * values and values are the number of times that value occurs in |
||
162 | * the original collection. |
||
163 | * |
||
164 | * @return NumericCollection |
||
165 | */ |
||
166 | public function counts() |
||
170 | |||
171 | protected function isConsistentDataStructure($data) |
||
184 | } |
||
185 |