1 | <?php |
||
38 | class SeedCollection implements \Dennis\Seeder\SeedCollection |
||
39 | { |
||
40 | /** |
||
41 | * seeds |
||
42 | * |
||
43 | * @var array $seeds |
||
44 | */ |
||
45 | protected $seeds = []; |
||
46 | |||
47 | /** |
||
48 | * Used Keys |
||
49 | * |
||
50 | * @var array |
||
51 | */ |
||
52 | protected $used = []; |
||
53 | |||
54 | /** |
||
55 | * @var int |
||
56 | */ |
||
57 | protected $i = 0; |
||
58 | |||
59 | /** |
||
60 | * @var int |
||
61 | */ |
||
62 | public $amount = 0; |
||
63 | |||
64 | /** |
||
65 | * @return array |
||
66 | */ |
||
67 | public function toArray() |
||
80 | |||
81 | /** |
||
82 | * @param Seeder $seeder |
||
83 | * @return array |
||
84 | */ |
||
85 | public function get(Seeder $seeder) |
||
105 | |||
106 | /** |
||
107 | * @param string $key |
||
108 | * @return bool |
||
109 | */ |
||
110 | public function isUsed($key) |
||
114 | |||
115 | /** |
||
116 | * each |
||
117 | * |
||
118 | * @param callable $function |
||
119 | * @return $this |
||
120 | */ |
||
121 | public function each(callable $function) |
||
134 | |||
135 | /** |
||
136 | * @param Seed $seed |
||
137 | * @throws \Exception |
||
138 | */ |
||
139 | public function attach(Seed $seed) |
||
155 | |||
156 | /** |
||
157 | * Returns a random seed. Returns null if there is no seed or there are less seeds than you want to create |
||
158 | * In this case you may $this->attach a new Seed. |
||
159 | * |
||
160 | * @param string $className |
||
161 | * @return Seed |
||
162 | */ |
||
163 | public function random($className, $i) |
||
171 | |||
172 | /** |
||
173 | * detach |
||
174 | * |
||
175 | * @param string $key |
||
176 | * @return void |
||
177 | */ |
||
178 | public function detach($key) |
||
184 | |||
185 | /** |
||
186 | * Checks if current position is valid |
||
187 | * |
||
188 | * @return bool |
||
189 | */ |
||
190 | public function valid() |
||
194 | |||
195 | /** |
||
196 | * Return the current element |
||
197 | * |
||
198 | * @return Seed |
||
199 | */ |
||
200 | public function current() |
||
204 | |||
205 | /** |
||
206 | * Move forward to next element |
||
207 | * |
||
208 | * @return Seed |
||
209 | */ |
||
210 | public function next() |
||
214 | |||
215 | /** |
||
216 | * Return the key of the current element |
||
217 | * |
||
218 | * @return Seed |
||
219 | */ |
||
220 | public function key() |
||
224 | |||
225 | /** |
||
226 | * Rewind the Iterator to the first element |
||
227 | * |
||
228 | * @return Seed |
||
229 | */ |
||
230 | public function rewind() |
||
234 | |||
235 | /** |
||
236 | * Count elements of an object |
||
237 | * |
||
238 | * @return int |
||
239 | */ |
||
240 | public function count() |
||
244 | |||
245 | /** |
||
246 | * @return void |
||
247 | */ |
||
248 | public function clear() |
||
252 | } |
||
253 |