Passed
Push — dev ( 117aec...fd7324 )
by Janko
15:18
created

SpacecraftHrefTrait   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Test Coverage

Coverage 90%

Importance

Changes 0
Metric Value
eloc 11
dl 0
loc 17
rs 10
c 0
b 0
f 0
ccs 9
cts 10
cp 0.9
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 2
    public function getHref(): string
10
    {
11 2
        $self = $this->getThis();
12 2
        $moduleView = $self->getType()->getModuleView();
13 2
        if ($moduleView === null) {
14
            return '';
15
        }
16
17 2
        return sprintf(
18 2
            '%s?%s=1&id=%d',
19 2
            $moduleView->getPhpPage(),
20 2
            $self->getType()->getViewIdentifier(),
21 2
            $self->getId()
22 2
        );
23
    }
24
}
25