|
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
|
|
|
public function __construct(HttpBuilder $builder = null) |
|
18
|
|
|
{ |
|
19
|
|
|
$this->builder = $builder ?: new HttpBuilder(); |
|
20
|
|
|
} |
|
21
|
|
|
|
|
22
|
|
|
public function __toString() |
|
23
|
|
|
{ |
|
24
|
|
|
return $this->builder->compile(); |
|
25
|
|
|
} |
|
26
|
|
|
|
|
27
|
|
|
public function getScheme(): ?string |
|
28
|
|
|
{ |
|
29
|
|
|
return $this->builder->getScheme(); |
|
30
|
|
|
} |
|
31
|
|
|
|
|
32
|
|
|
public function getAuthority(): ?string |
|
33
|
|
|
{ |
|
34
|
|
|
$auth = $this->getUserInfo(); |
|
35
|
|
|
$host = $this->getHost(); |
|
36
|
|
|
$port = $this->getPort(); |
|
37
|
|
|
|
|
38
|
|
|
$auth = $auth ? $auth . '@' : ''; |
|
39
|
|
|
$port = $port ? ':' . $port : ''; |
|
40
|
|
|
|
|
41
|
|
|
return $auth . $host . $port; |
|
42
|
|
|
} |
|
43
|
|
|
|
|
44
|
|
|
public function getUserInfo(): ?string |
|
45
|
|
|
{ |
|
46
|
|
|
if (empty($this->builder->getUser()) && empty($this->builder->getUser())) { |
|
|
|
|
|
|
47
|
|
|
return null; |
|
48
|
|
|
} |
|
49
|
|
|
|
|
50
|
|
|
$user = Stringable::of($this->builder->getUser())->trim(); |
|
51
|
|
|
$password = Stringable::of($this->builder->getPass())->trim()->start(':'); |
|
52
|
|
|
|
|
53
|
|
|
return $user . $password; |
|
54
|
|
|
} |
|
55
|
|
|
|
|
56
|
|
|
public function getHost(): ?string |
|
57
|
|
|
{ |
|
58
|
|
|
return $this->builder->getHost(); |
|
59
|
|
|
} |
|
60
|
|
|
|
|
61
|
|
|
public function getPort(): ?int |
|
62
|
|
|
{ |
|
63
|
|
|
return $this->builder->getPort(); |
|
|
|
|
|
|
64
|
|
|
} |
|
65
|
|
|
|
|
66
|
|
|
public function getPath(): ?string |
|
67
|
|
|
{ |
|
68
|
|
|
return $this->builder->getPath(); |
|
69
|
|
|
} |
|
70
|
|
|
|
|
71
|
|
|
public function getQuery(): ?string |
|
72
|
|
|
{ |
|
73
|
|
|
return $this->builder->getQuery(); |
|
74
|
|
|
} |
|
75
|
|
|
|
|
76
|
|
|
public function getFragment(): ?string |
|
77
|
|
|
{ |
|
78
|
|
|
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