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