RequestUrlAccess   A
last analyzed

Complexity

Total Complexity 11

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 29
c 0
b 0
f 0
wmc 11
lcom 0
cbo 1
ccs 23
cts 23
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
B getValueFromUrlPlaceholder() 0 26 11
1
<?php
2
3
namespace Mcustiel\PowerRoute\Common;
4
5
use Psr\Http\Message\UriInterface;
6
7
trait RequestUrlAccess
8
{
9 11
    private function getValueFromUrlPlaceholder($name, UriInterface $uri)
10
    {
11
        switch ($name) {
12 11
            case 'full':
13 11
            case null:
14 2
                return $uri->__toString();
15 9
            case 'host':
16 1
                return $uri->getHost();
17 8
            case 'scheme':
18 1
                return $uri->getScheme();
19 7
            case 'authority':
20 1
                return $uri->getAuthority();
21 6
            case 'fragment':
22 1
                return $uri->getFragment();
23 5
            case 'path':
24 1
                return $uri->getPath();
25 4
            case 'port':
26 1
                return $uri->getPort();
27 3
            case 'query':
28 1
                return $uri->getQuery();
29 2
            case 'user-info':
30 1
                return $uri->getUserInfo();
31 1
            default:
32 1
                throw new \Exception('Invalid config');
33 1
        }
34
    }
35
}
36