Test Failed
Pull Request — master (#2138)
by Nico
07:39
created

SpacecraftHrefTrait   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 11
c 0
b 0
f 0
dl 0
loc 17
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A getHref() 0 13 2
1
<?php
2
3
namespace Stu\Component\Spacecraft\Trait;
4
5
trait SpacecraftHrefTrait
6
{
7
    use SpacecraftTrait;
8
9
    public function getHref(): string
10
    {
11
        $self = $this->getThis();
12
        $moduleView = $self->getType()->getModuleView();
13
        if ($moduleView === null) {
14
            return '';
15
        }
16
17
        return sprintf(
18
            '%s?%s=1&id=%d',
19
            $moduleView->getPhpPage(),
20
            $self->getType()->getViewIdentifier(),
21
            $self->getId()
22
        );
23
    }
24
}
25