| Total Complexity | 6 |
| Total Lines | 32 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 7 | class UniqueEntitySet |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * @var \SplObjectStorage |
||
| 11 | */ |
||
| 12 | protected $entities; |
||
| 13 | |||
| 14 | public function __construct() |
||
| 15 | { |
||
| 16 | $this->entities = new \SplObjectStorage(); |
||
| 17 | } |
||
| 18 | |||
| 19 | public function addOne($entity) |
||
| 20 | { |
||
| 21 | $this->entities->attach($entity); |
||
| 22 | } |
||
| 23 | |||
| 24 | public function addMany(array $entities) |
||
| 25 | { |
||
| 26 | foreach ($entities as $entity) { |
||
| 27 | $this->addOne($entity); |
||
| 28 | } |
||
| 29 | } |
||
| 30 | |||
| 31 | public function getAll(): ArrayCollection |
||
| 39 | } |
||
| 40 | } |
||
| 41 |