RouterInjectingRepository::enrichEntityAtLoad()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 2
1
<?php
2
3
namespace Kaliop\eZObjectWrapperBundle\Core\Traits;
4
5
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
6
7
trait RouterInjectingRepository
8
{
9
    protected $router;
10
11 10
    public function setRouter(UrlGeneratorInterface $router)
12
    {
13 10
        $this->router = $router;
14 10
        return $this; // fluent interfaces for setters
15
    }
16
17
    protected function enrichEntityAtLoad($entity)
18
    {
19
        return $entity->setRouter($this->router);
20
    }
21
}
22