Passed
Push — develop ( 4f08b4...f08141 )
by Daniel
05:37
created

RouteAwareTrait::getRoutes()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 0
cts 2
cp 0
crap 2
rs 10
c 0
b 0
f 0
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
    /**
39
     * @return ArrayCollection|Route[]
40
     */
41
    public function getRoutes(): ArrayCollection
42
    {
43
        return $this->routes;
44
    }
45
}
46