Completed
Push — master ( 6cd8ca...cbb2b9 )
by Paweł
63:35
created

RouteAwareTrait   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 4
c 0
b 0
f 0
lcom 1
cbo 0
dl 0
loc 33
ccs 0
cts 3
cp 0
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getRoute() 0 4 1
A setRoute() 0 4 1
A getRouteId() 0 6 2
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the Superdesk Web Publisher Content Bundle.
7
 *
8
 * Copyright 2017 Sourcefabric z.ú. and contributors.
9
 *
10
 * For the full copyright and license information, please see the
11
 * AUTHORS and LICENSE files distributed with this source code.
12
 *
13
 * @copyright 2017 Sourcefabric z.ú
14
 * @license http://www.superdesk.org/license
15 14
 */
16
17 14
namespace SWP\Bundle\ContentBundle\Model;
18
19
trait RouteAwareTrait
20
{
21
    /**
22
     * @var RouteInterface|null
23
     */
24
    protected $route;
25
26
    /**
27
     * @return RouteInterface|null
28
     */
29
    public function getRoute()
30
    {
31
        return $this->route;
32
    }
33
34
    /**
35
     * @param RouteInterface $route
36
     */
37
    public function setRoute(RouteInterface $route = null)
38
    {
39
        $this->route = $route;
40
    }
41
42
    /**
43
     * @return int|null
44
     */
45
    public function getRouteId()
46
    {
47
        if (null !== $this->route) {
48
            return $this->route->getId();
49
        }
50
    }
51
}
52