Total Complexity | 4 |
Total Lines | 38 |
Duplicated Lines | 0 % |
Coverage | 70% |
Changes | 0 |
1 | <?php |
||
10 | trait RouteAwareTrait |
||
11 | { |
||
12 | /** |
||
13 | * @ORM\OneToMany(targetEntity="Silverback\ApiComponentBundle\Entity\Route\Route", mappedBy="content", cascade={"persist"}) |
||
14 | * @Groups({"layout", "content", "component"}) |
||
15 | * @var Collection|Route[] |
||
16 | */ |
||
17 | protected $routes; |
||
18 | |||
19 | /** |
||
20 | * @param Route $route |
||
21 | * @return RouteAwareInterface|RouteAwareTrait |
||
22 | */ |
||
23 | 1 | public function addRoute(Route $route) |
|
24 | { |
||
25 | 1 | if ($this instanceof AbstractContent) { |
|
26 | 1 | $route->setContent($this); |
|
27 | } |
||
28 | 1 | $this->routes->add($route); |
|
29 | 1 | return $this; |
|
30 | } |
||
31 | |||
32 | /** |
||
33 | * @param Route $route |
||
34 | * @return RouteAwareInterface|RouteAwareTrait |
||
35 | */ |
||
36 | public function removeRoute(Route $route) |
||
40 | } |
||
41 | |||
42 | /** |
||
43 | * @return Collection|Route[] |
||
44 | */ |
||
45 | 1 | public function getRoutes(): Collection |
|
48 | } |
||
49 | } |
||
50 |