1 | <?php |
||
21 | class TabularCollection extends MultiCollection |
||
22 | { |
||
23 | /** |
||
24 | * Is input data structure valid? |
||
25 | * |
||
26 | * In order to determine whether a given data structure is valid for a |
||
27 | * particular collection type (tabular, numeric, etc.), we have this method. |
||
28 | * |
||
29 | * @param mixed $data The data structure to check |
||
30 | * @return boolean True if data structure is tabular |
||
31 | */ |
||
32 | 38 | protected function isConsistentDataStructure($data) |
|
36 | |||
37 | /** |
||
38 | * Does this collection have specified column? |
||
39 | * |
||
40 | * @param mixed $column The column index |
||
41 | * @return bool |
||
42 | */ |
||
43 | public function hasColumn($column) |
||
52 | |||
53 | /** |
||
54 | * Get column as collection |
||
55 | * |
||
56 | * @param mixed $column The column index |
||
57 | * @param bool $throw Throw an exception on failure |
||
58 | * @return AbstractCollection|false |
||
59 | */ |
||
60 | public function getColumn($column, $throw = true) |
||
71 | |||
72 | /** |
||
73 | * Does this collection have a row at specified index? |
||
74 | * |
||
75 | * @param int $offset The column index |
||
76 | * @return bool |
||
77 | */ |
||
78 | public function hasRow($offset) |
||
87 | |||
88 | /** |
||
89 | * Get row at specified index. |
||
90 | * |
||
91 | * @param int $offset The row offset (starts from 0) |
||
92 | * @param bool $throw Whether or not to throw an exception if row does not exist |
||
93 | * |
||
94 | * @return AbstractCollection|false |
||
95 | */ |
||
96 | public function getRow($offset, $throw = true) |
||
107 | |||
108 | /** |
||
109 | * @inheritdoc |
||
110 | */ |
||
111 | 1 | public function map(callable $callback) |
|
119 | |||
120 | /** |
||
121 | * @inheritdoc |
||
122 | */ |
||
123 | 21 | public function walk(callable $callback, $extraContext = null) |
|
130 | |||
131 | // public function average($column) |
||
132 | // { |
||
133 | // $coll = $this->getColumnAsCollection($column); |
||
134 | // return $coll->sum() / $coll->count(); |
||
135 | // } |
||
136 | // |
||
137 | // public function mode($column) |
||
138 | // { |
||
139 | // return $this->getColumnAsCollection($column)->mode(); |
||
140 | // } |
||
141 | // |
||
142 | // public function sum($column) |
||
143 | // { |
||
144 | // return $this->getColumnAsCollection($column)->sum(); |
||
145 | // } |
||
146 | // |
||
147 | // public function median($column) |
||
148 | // { |
||
149 | // return $this->getColumnAsCollection($column)->median(); |
||
150 | // } |
||
151 | // |
||
152 | // protected function getColumnAsCollection($column) |
||
153 | // { |
||
154 | // return static::factory(array_column($this->data, $column)); |
||
155 | // } |
||
156 | |||
157 | /** |
||
158 | * Magic method call |
||
159 | * |
||
160 | * @param string $method The name of the method |
||
161 | * @param array $args The argument list |
||
162 | * |
||
163 | * @throws BadMethodCallException If no method exists |
||
164 | * |
||
165 | * @return mixed |
||
166 | * |
||
167 | * @todo Add phpdoc comments for dynamic methods |
||
168 | * @todo throw BadMethodCallException |
||
169 | */ |
||
170 | 8 | public function __call($method, $args) |
|
181 | } |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.