DoctrineOrmCollectionCollectionTraversalStrategy   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 17
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A supports() 0 3 1
A traverse() 0 4 1
1
<?php
2
3
namespace Xsolve\Associate\CollectionTraversal;
4
5
use Doctrine\Common\Collections\Collection;
6
use Xsolve\Associate\ObjectCollection\ObjectCollectionInterface;
7
8
class DoctrineOrmCollectionCollectionTraversalStrategy implements CollectionTraversalStrategyInterface
9
{
10
    /**
11
     * {@inheritdoc}
12
     */
13
    public function supports($propertyValue): bool
14
    {
15
        return $propertyValue instanceof Collection;
16
    }
17
18
    /**
19
     * {@inheritdoc}
20
     */
21
    public function traverse(ObjectCollectionInterface $objectCollection, $propertyValue)
22
    {
23
        /* @var Collection $propertyValue */
24
        $objectCollection->addMany($propertyValue->getValues());
25
    }
26
}
27