Conditions | 4 |
Paths | 6 |
Total Lines | 17 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 4.016 |
Changes | 0 |
1 | <?php |
||
20 | 30 | public function create(DocumentManager $dm, array $mapping, ?BaseCollection $coll = null) : PersistentCollectionInterface |
|
21 | { |
||
22 | 30 | if ($coll === null) { |
|
23 | 4 | $coll = ! empty($mapping['collectionClass']) |
|
24 | ? $this->createCollectionClass($mapping['collectionClass']) |
||
25 | 4 | : new ArrayCollection(); |
|
26 | } |
||
27 | |||
28 | 30 | if (empty($mapping['collectionClass'])) { |
|
29 | 29 | return new PersistentCollection($coll, $dm, $dm->getUnitOfWork()); |
|
30 | } |
||
31 | |||
32 | 1 | $className = $dm->getConfiguration()->getPersistentCollectionGenerator() |
|
33 | 1 | ->loadClass($mapping['collectionClass'], $dm->getConfiguration()->getAutoGeneratePersistentCollectionClasses()); |
|
34 | |||
35 | 1 | return new $className($coll, $dm, $dm->getUnitOfWork()); |
|
36 | } |
||
37 | |||
47 |