Passed
Push — master ( 9b607e...bd3df0 )
by Rougin
02:23
created

Uri::host()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
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 Royce Gutib <[email protected]>
14
 */
15
class Uri extends BaseUri implements ZapheusUriInterface
16
{
17
    /**
18
     * @var \Psr\Http\Message\UriInterface
19
     */
20
    protected $uri;
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();
0 ignored issues
show
Bug Best Practice introduced by
The property authority does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
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 = (string) $uri;
0 ignored issues
show
Documentation Bug introduced by
It seems like (string)$uri of type string is incompatible with the declared type Psr\Http\Message\UriInterface of property $uri.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
46 54
    }
47
}
48