Passed
Push — master ( 1e50c9...40c138 )
by Rougin
02:53
created

Uri   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 19 1
1
<?php
2
3
namespace Zapheus\Bridge\Psr\Zapheus;
4
5
use Psr\Http\Message\UriInterface;
6
use Zapheus\Http\Message\Uri as BaseUri;
7
use Zapheus\Http\Message\UriInterface as ZapheusUriInterface;
8
9
/**
10
 * PSR-07 to Zapheus URI Bridge
11
 *
12
 * @package Zapheus
13
 * @author  Rougin Gutib <[email protected]>
14
 */
15
class Uri extends BaseUri implements ZapheusUriInterface
16
{
17
    /**
18
     * @var string
19
     */
20
    protected $authority;
21
22
    /**
23
     * Initializes the URI instance.
24
     *
25
     * @param \Psr\Http\Message\UriInterface $uri
26
     */
27 54
    public function __construct(UriInterface $uri)
28
    {
29 54
        $this->fragment = $uri->getFragment();
30
31 54
        $this->query = $uri->getQuery();
32
33 54
        $this->authority = $uri->getAuthority();
34
35 54
        $this->host = $uri->getHost();
36
37 54
        $this->path = $uri->getPath();
38
39 54
        $this->port = $uri->getPort();
40
41 54
        $this->scheme = $uri->getScheme();
42
43 54
        $this->user = $uri->getUserInfo();
44
45 54
        $this->uri = $uri->__toString();
46 54
    }
47
}
48