1 | <?php |
||
38 | class SeedCollection implements \TildBJ\Seeder\SeedCollection |
||
39 | { |
||
40 | /** |
||
41 | * seeds |
||
42 | * |
||
43 | * @var array $seeds |
||
44 | */ |
||
45 | protected $seeds = []; |
||
46 | |||
47 | /** |
||
48 | * @var array $temp |
||
49 | */ |
||
50 | protected $temp = []; |
||
51 | |||
52 | /** |
||
53 | * @var int |
||
54 | */ |
||
55 | protected $i = 0; |
||
56 | |||
57 | /** |
||
58 | * @return array |
||
59 | */ |
||
60 | 9 | public function toArray() |
|
73 | |||
74 | /** |
||
75 | * @param Seeder $seeder |
||
76 | * @return array |
||
77 | */ |
||
78 | 10 | public function get(Seeder $seeder) |
|
96 | |||
97 | /** |
||
98 | * each |
||
99 | * |
||
100 | * @param callable $function |
||
101 | * @return $this |
||
102 | */ |
||
103 | 7 | public function each(callable $function) |
|
117 | |||
118 | /** |
||
119 | * @param Seed $seed |
||
120 | * @throws \Exception |
||
121 | */ |
||
122 | 15 | public function attach(Seed $seed) |
|
128 | |||
129 | /** |
||
130 | * Returns a random seed. Returns null if there is no seed or there are less seeds than you want to create |
||
131 | * In this case you may $this->attach a new Seed. |
||
132 | * |
||
133 | * @param string $className |
||
134 | * @return Seed |
||
135 | */ |
||
136 | public function random($className, $i) |
||
144 | |||
145 | /** |
||
146 | * detach |
||
147 | * |
||
148 | * @param string $key |
||
149 | * @return void |
||
150 | */ |
||
151 | public function detach($key) |
||
157 | |||
158 | /** |
||
159 | * Checks if current position is valid |
||
160 | * |
||
161 | * @return bool |
||
162 | */ |
||
163 | 1 | public function valid() |
|
167 | |||
168 | /** |
||
169 | * Return the current element |
||
170 | * |
||
171 | * @return Seed |
||
172 | */ |
||
173 | 4 | public function current() |
|
177 | |||
178 | /** |
||
179 | * Move forward to next element |
||
180 | * |
||
181 | * @return Seed |
||
182 | */ |
||
183 | 1 | public function next() |
|
187 | |||
188 | /** |
||
189 | * Return the key of the current element |
||
190 | * |
||
191 | * @return Seed |
||
192 | */ |
||
193 | 1 | public function key() |
|
197 | |||
198 | /** |
||
199 | * Rewind the Iterator to the first element |
||
200 | * |
||
201 | * @return Seed |
||
202 | */ |
||
203 | 1 | public function rewind() |
|
207 | |||
208 | /** |
||
209 | * Count elements of an object |
||
210 | * |
||
211 | * @return int |
||
212 | */ |
||
213 | 1 | public function count() |
|
217 | |||
218 | /** |
||
219 | * @param string $name |
||
220 | * @return int |
||
221 | */ |
||
222 | 6 | public function countByName($name) |
|
229 | |||
230 | /** |
||
231 | * @return void |
||
232 | */ |
||
233 | 15 | public function clear() |
|
238 | } |
||
239 |