AbstractUri   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 25
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A __toString() 0 3 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace BEAR\Resource;
6
7
use Stringable;
8
9
use function http_build_query;
10
11
abstract class AbstractUri implements Stringable
12
{
13
    /** @var string */
14
    public $scheme;
15
16
    /** @var string */
17
    public $host;
18
19
    /** @var string */
20
    public $path;
21
22
    /**
23
     * Associative query array
24
     *
25
     * @var array<string, mixed>
26
     */
27
    public $query = [];
28
29
    /** @var string */
30
    public $method = 'get';
31
32
    /** @return string */
33
    public function __toString()
34
    {
35
        return "{$this->scheme}://{$this->host}{$this->path}" . ($this->query ? '?' . http_build_query($this->query) : '');
36
    }
37
}
38