1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Helldar\Support\Tools\Http; |
4
|
|
|
|
5
|
|
|
use Helldar\Support\Concerns\Makeable; |
6
|
|
|
use Helldar\Support\Facades\Helpers\Ables\Stringable; |
|
|
|
|
7
|
|
|
use Helldar\Support\Helpers\HttpBuilder; |
8
|
|
|
use Psr\Http\Message\UriInterface; |
9
|
|
|
|
10
|
|
|
class Uri implements UriInterface |
11
|
|
|
{ |
12
|
|
|
use Makeable; |
13
|
|
|
|
14
|
|
|
/** @var \Helldar\Support\Helpers\HttpBuilder */ |
15
|
|
|
protected $builder; |
16
|
|
|
|
17
|
4 |
|
public function __construct(HttpBuilder $builder = null) |
18
|
|
|
{ |
19
|
4 |
|
$this->builder = $builder ?: new HttpBuilder(); |
20
|
4 |
|
} |
21
|
|
|
|
22
|
4 |
|
public function __toString() |
23
|
|
|
{ |
24
|
4 |
|
return $this->builder->compile(); |
25
|
|
|
} |
26
|
|
|
|
27
|
2 |
|
public function getScheme(): ?string |
28
|
|
|
{ |
29
|
2 |
|
return $this->builder->getScheme(); |
30
|
|
|
} |
31
|
|
|
|
32
|
2 |
|
public function getAuthority(): ?string |
33
|
|
|
{ |
34
|
2 |
|
$auth = $this->getUserInfo(); |
35
|
2 |
|
$host = $this->getHost(); |
36
|
2 |
|
$port = $this->getPort(); |
37
|
|
|
|
38
|
2 |
|
$auth = $auth ? $auth . '@' : ''; |
39
|
2 |
|
$port = $port ? ':' . $port : ''; |
40
|
|
|
|
41
|
2 |
|
return $auth . $host . $port; |
42
|
|
|
} |
43
|
|
|
|
44
|
2 |
|
public function getUserInfo(): ?string |
45
|
|
|
{ |
46
|
2 |
|
if (empty($this->builder->getUser()) && empty($this->builder->getUser())) { |
|
|
|
|
47
|
|
|
return null; |
48
|
|
|
} |
49
|
|
|
|
50
|
2 |
|
$user = Stringable::of($this->builder->getUser())->trim(); |
51
|
2 |
|
$password = Stringable::of($this->builder->getPass())->trim()->start(':'); |
52
|
|
|
|
53
|
2 |
|
return $user . $password; |
54
|
|
|
} |
55
|
|
|
|
56
|
2 |
|
public function getHost(): ?string |
57
|
|
|
{ |
58
|
2 |
|
return $this->builder->getHost(); |
59
|
|
|
} |
60
|
|
|
|
61
|
2 |
|
public function getPort(): ?int |
62
|
|
|
{ |
63
|
2 |
|
return $this->builder->getPort(); |
|
|
|
|
64
|
|
|
} |
65
|
|
|
|
66
|
2 |
|
public function getPath(): ?string |
67
|
|
|
{ |
68
|
2 |
|
return $this->builder->getPath(); |
69
|
|
|
} |
70
|
|
|
|
71
|
2 |
|
public function getQuery(): ?string |
72
|
|
|
{ |
73
|
2 |
|
return $this->builder->getQuery(); |
74
|
|
|
} |
75
|
|
|
|
76
|
2 |
|
public function getFragment(): ?string |
77
|
|
|
{ |
78
|
2 |
|
return $this->builder->getFragment(); |
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
public function withScheme($scheme): self |
82
|
|
|
{ |
83
|
|
|
$this->builder->setScheme($scheme); |
84
|
|
|
|
85
|
|
|
return $this; |
86
|
|
|
} |
87
|
|
|
|
88
|
|
|
public function withUserInfo($user, $password = null): self |
89
|
|
|
{ |
90
|
|
|
$this->builder->setUser($user); |
91
|
|
|
$this->builder->setPass($password); |
92
|
|
|
|
93
|
|
|
return $this; |
94
|
|
|
} |
95
|
|
|
|
96
|
|
|
public function withHost($host): self |
97
|
|
|
{ |
98
|
|
|
$this->builder->setHost($host); |
99
|
|
|
|
100
|
|
|
return $this; |
101
|
|
|
} |
102
|
|
|
|
103
|
|
|
public function withPort($port): self |
104
|
|
|
{ |
105
|
|
|
$this->builder->setPort($port); |
106
|
|
|
|
107
|
|
|
return $this; |
108
|
|
|
} |
109
|
|
|
|
110
|
|
|
public function withPath($path): self |
111
|
|
|
{ |
112
|
|
|
$this->builder->setPath($path); |
113
|
|
|
|
114
|
|
|
return $this; |
115
|
|
|
} |
116
|
|
|
|
117
|
|
|
public function withQuery($query): self |
118
|
|
|
{ |
119
|
|
|
$this->builder->setQuery($query); |
120
|
|
|
|
121
|
|
|
return $this; |
122
|
|
|
} |
123
|
|
|
|
124
|
|
|
public function withFragment($fragment): self |
125
|
|
|
{ |
126
|
|
|
$this->builder->setFragment($fragment); |
127
|
|
|
|
128
|
|
|
return $this; |
129
|
|
|
} |
130
|
|
|
} |
131
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths