Literal::match()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 5
c 1
b 0
f 0
nc 2
nop 1
dl 0
loc 7
ccs 5
cts 5
cp 1
crap 2
rs 10
1
<?php
2
3
namespace Nip\Router\Parsers;
4
5
/**
6
 * Class Literal
7
 * @package Nip\Router\Parsers
8
 */
9
class Literal extends AbstractParser
10
{
11
12
    /**
13
     * @param $uri
14
     * @return bool
15
     */
16 1
    public function match($uri)
17
    {
18 1
        $return = parent::match($uri);
19 1
        $map = rtrim($this->getMap(), '/');
20 1
        $uri = rtrim($uri, '/');
21
22 1
        return ($return) ? $map == $uri : false;
0 ignored issues
show
introduced by
The condition $return is always true.
Loading history...
23
    }
24
25
    /** @noinspection PhpMissingParentCallCommonInspection
26
     * @param array $params
27
     * @return mixed|string
28
     */
29 1
    public function assemble($params = [])
30
    {
31 1
        $params = $this->stripEmptyParams($params);
32
33 1
        return $this->getMap() . ($params ? '?' . http_build_query($params) : '');
34
    }
35
}
36