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

RouteAwareTrait::getRouteId()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 6
ccs 0
cts 0
cp 0
rs 9.4285
cc 2
eloc 3
nc 2
nop 0
crap 6
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