HasGeneratorTrait   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 2
Bugs 0 Features 1
Metric Value
eloc 5
c 2
b 0
f 1
dl 0
loc 23
ccs 0
cts 6
cp 0
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A assemble() 0 4 1
A assembleFull() 0 4 1
1
<?php
2
3
namespace Nip\Router\Router\Traits;
4
5
use Nip\Router\Route\Route;
6
use Nip\Router\Router;
7
8
/**
9
 * Trait HasGeneratorTrait
10
 * @package Nip\Router\Router\Traits
11
 */
12
trait HasGeneratorTrait
13
{
14
15
    /**
16
     * @param $name
17
     * @param array $params
18
     * @return string|null
19
     */
20
    public function assemble($name, $params = [])
21
    {
22
        $params = (array) $params;
23
        return $this->generate($name, $params);
0 ignored issues
show
Bug introduced by
It seems like generate() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

23
        return $this->/** @scrutinizer ignore-call */ generate($name, $params);
Loading history...
24
    }
25
26
    /**
27
     * @param $name
28
     * @param array $params
29
     * @return string
30
     */
31
    public function assembleFull($name, $params = [])
32
    {
33
        $params = (array) $params;
34
        return $this->generate($name, $params, self::ABSOLUTE_URL);
0 ignored issues
show
Bug introduced by
The constant Nip\Router\Router\Traits...atorTrait::ABSOLUTE_URL was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
35
    }
36
}
37