Lines
0.00%
0 / 19
Methods
0.00%
0 / 6
Classes
0.00%
0 / 1
| Name | Lines | Methods | CRAP | ||||
|---|---|---|---|---|---|---|---|
| [BO\Zmsdldb\Importer\MySQL\Entity\Collection] offsetExists | 0.00% | 0 / 1 | 0.00% | 0 / 1 | 2 | ||
| [BO\Zmsdldb\Importer\MySQL\Entity\Collection] offsetGet | 0.00% | 0 / 3 | 0.00% | 0 / 1 | 6 | ||
| [BO\Zmsdldb\Importer\MySQL\Entity\Collection] offsetSet | 0.00% | 0 / 8 | 0.00% | 0 / 1 | 12 | ||
| [BO\Zmsdldb\Importer\MySQL\Entity\Collection] offsetUnset | 0.00% | 0 / 2 | 0.00% | 0 / 1 | 2 | ||
| [BO\Zmsdldb\Importer\MySQL\Entity\Collection] count | 0.00% | 0 / 1 | 0.00% | 0 / 1 | 2 | ||
| [BO\Zmsdldb\Importer\MySQL\Entity\Collection] saveEntities | 0.00% | 0 / 4 | 0.00% | 0 / 1 | 12 | ||
| 5 | class Collection extends \BO\Zmsdldb\Importer\MySQL\Entity\Collection | |
| 6 | { | |
| 7 | } |
Inherited from BO\Zmsdldb\Importer\MySQL\Entity\Collection
| 14 | final public function offsetExists($offset): bool | |
| 15 | { | |
| 16 | return array_key_exists($offset, $this->entities); | |
| 17 | } |
| 20 | final public function offsetGet($offset): Base | |
| 21 | { | |
| 22 | if ($this->offsetExists($offset)) { | |
| 23 | return $this->entities[$offset]; | |
| 24 | } | |
| 25 | throw new \InvalidArgumentException(__METHOD__ . " offset({$offset}) has not been set!"); | |
| 26 | } |
| 29 | final public function offsetSet($offset, $value): Collection | |
| 30 | { | |
| 31 | if (!$value instanceof Base) { | |
| 32 | throw new \InvalidArgumentException( | |
| 33 | __METHOD__ . ' $value must be an instance of \\BO\\Zmsdldb\\Importer\\MySQL\\Entity\\Base' | |
| 34 | ); | |
| 35 | } | |
| 36 | if (null === $offset) { | |
| 37 | $this->entities[] = $value; | |
| 38 | } else { | |
| 39 | $this->entities[$offset] = $value; | |
| 40 | } | |
| 41 | return $this; | |
| 42 | } |
| 45 | final public function offsetUnset($offset): Collection | |
| 46 | { | |
| 47 | unset($this->entities[$offset]); | |
| 48 | return $this; | |
| 49 | } |
| 52 | final public function count(): int | |
| 53 | { | |
| 54 | return count($this->entities); | |
| 55 | } |
| 58 | public function saveEntities(): void | |
| 59 | { | |
| 60 | try { | |
| 61 | foreach ($this->entities as $entity) { | |
| 62 | $entity->save(); | |
| 63 | } | |
| 64 | } catch (\Exception $e) { | |
| 65 | throw $e; | |
| 66 | } | |
| 67 | } |