Literal   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
c 1
b 0
f 0
dl 0
loc 25
ccs 8
cts 8
cp 1
rs 10
wmc 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A assemble() 0 5 2
A match() 0 7 2
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