HasGeneratorTrait::assemble()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

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