1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace BEAR\Resource; |
6
|
|
|
|
7
|
|
|
use OutOfRangeException; |
8
|
|
|
use Override; |
9
|
|
|
|
10
|
|
|
use function array_merge; |
11
|
|
|
use function in_array; |
12
|
|
|
|
13
|
|
|
/** |
14
|
|
|
* @property $this $lazy |
15
|
|
|
* @property $this $eager |
16
|
|
|
* @psalm-suppress PropertyNotSetInConstructor for DSL |
17
|
|
|
* @psalm-import-type Query from Types |
18
|
|
|
*/ |
19
|
|
|
final class Request extends AbstractRequest |
20
|
|
|
{ |
21
|
|
|
public const GET = 'get'; |
22
|
|
|
public const POST = 'post'; |
23
|
|
|
public const PUT = 'put'; |
24
|
|
|
public const PATCH = 'patch'; |
25
|
|
|
public const DELETE = 'delete'; |
26
|
|
|
public const HEAD = 'head'; |
27
|
|
|
public const OPTIONS = 'options'; |
28
|
|
|
|
29
|
|
|
/** @psalm-suppress ImplementedReturnTypeMismatch */ |
30
|
|
|
#[Override] |
31
|
|
|
public function __get(string $name): mixed |
32
|
|
|
{ |
33
|
|
|
if ($name === 'eager' || $name === 'lazy') { |
34
|
|
|
$this->in = $name; |
35
|
|
|
|
36
|
|
|
return $this; |
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
if (in_array($name, ['code', 'headers', 'body'], true)) { |
40
|
|
|
return parent::__get($name); |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
throw new OutOfRangeException($name); |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* {@inheritDoc} |
48
|
|
|
* |
49
|
|
|
* @param Query $query |
|
|
|
|
50
|
|
|
*/ |
51
|
|
|
#[Override] |
52
|
|
|
public function withQuery(array $query): RequestInterface |
53
|
|
|
{ |
54
|
|
|
$this->query = $query; |
|
|
|
|
55
|
|
|
|
56
|
|
|
return $this; |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* {@inheritDoc} |
61
|
|
|
*/ |
62
|
|
|
#[Override] |
63
|
|
|
public function addQuery(array $query): RequestInterface |
64
|
|
|
{ |
65
|
|
|
$this->query = array_merge($this->query, $query); |
|
|
|
|
66
|
|
|
|
67
|
|
|
return $this; |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
/** |
71
|
|
|
* {@inheritDoc} |
72
|
|
|
*/ |
73
|
|
|
#[Override] |
74
|
|
|
public function toUriWithMethod(): string |
75
|
|
|
{ |
76
|
|
|
$uri = $this->toUri(); |
77
|
|
|
|
78
|
|
|
return "{$this->method} {$uri}"; |
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
/** |
82
|
|
|
* {@inheritDoc} |
83
|
|
|
*/ |
84
|
|
|
#[Override] |
85
|
|
|
public function toUri(): string |
86
|
|
|
{ |
87
|
|
|
$this->resourceObject->uri->query = $this->query; |
|
|
|
|
88
|
|
|
|
89
|
|
|
return (string) $this->resourceObject->uri; |
90
|
|
|
} |
91
|
|
|
|
92
|
|
|
/** |
93
|
|
|
* {@inheritDoc} |
94
|
|
|
*/ |
95
|
|
|
#[Override] |
96
|
|
|
public function linkSelf(string $linkKey): RequestInterface |
97
|
|
|
{ |
98
|
|
|
$this->links[] = new LinkType($linkKey, LinkType::SELF_LINK); |
99
|
|
|
|
100
|
|
|
return $this; |
101
|
|
|
} |
102
|
|
|
|
103
|
|
|
/** |
104
|
|
|
* {@inheritDoc} |
105
|
|
|
*/ |
106
|
|
|
#[Override] |
107
|
|
|
public function linkNew(string $linkKey): RequestInterface |
108
|
|
|
{ |
109
|
|
|
$this->links[] = new LinkType($linkKey, LinkType::NEW_LINK); |
110
|
|
|
|
111
|
|
|
return $this; |
112
|
|
|
} |
113
|
|
|
|
114
|
|
|
/** |
115
|
|
|
* {@inheritDoc} |
116
|
|
|
*/ |
117
|
|
|
#[Override] |
118
|
|
|
public function linkCrawl(string $linkKey): RequestInterface |
119
|
|
|
{ |
120
|
|
|
$this->links[] = new LinkType($linkKey, LinkType::CRAWL_LINK); |
121
|
|
|
|
122
|
|
|
return $this; |
123
|
|
|
} |
124
|
|
|
} |
125
|
|
|
|
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