Passed
Push — develop ( 435f98...653998 )
by Daniel
05:24
created

RouteAwareTrait   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
dl 0
loc 27
ccs 0
cts 6
cp 0
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A removeRoute() 0 4 1
A addRoute() 0 4 1
1
<?php
2
3
namespace Silverback\ApiComponentBundle\Entity\Route;
4
5
use Doctrine\Common\Collections\ArrayCollection;
6
use Doctrine\ORM\Mapping as ORM;
7
use Symfony\Component\Serializer\Annotation\Groups;
8
9
trait RouteAwareTrait
10
{
11
    /**
12
     * @ORM\OneToMany(targetEntity="Silverback\ApiComponentBundle\Entity\Route\Route", mappedBy="content")
13
     * @Groups({"layout", "content", "component"})
14
     * @var ArrayCollection|Route[]
15
     */
16
    protected $routes;
17
18
    /**
19
     * @param Route $route
20
     * @return RouteAwareInterface|RouteAwareTrait
21
     */
22
    public function addRoute(Route $route)
23
    {
24
        $this->routes->add($route);
25
        return $this;
26
    }
27
28
    /**
29
     * @param Route $route
30
     * @return RouteAwareInterface|RouteAwareTrait
31
     */
32
    public function removeRoute(Route $route)
33
    {
34
        $this->routes->removeElement($route);
35
        return $this;
36
    }
37
}
38