Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GitAuto: [FEATURE] Use Response class for handling Request responses #280

Closed
wants to merge 386 commits into from
Closed
Changes from all commits
Commits
Show all changes
386 commits
Select commit Hold shift + click to select a range
453e54d
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
348d3ba
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
4b3b41b
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
c959f15
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
98c4539
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
f4788cd
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
acfc79f
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
de9d7c3
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
1d51939
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
7969497
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
78e4682
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
90f84e9
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
e572c01
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
9ba7122
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
d3c1359
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
007c2f0
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
3d76e8f
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
422319e
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
bf3e38a
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
6960239
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
20f3e84
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
de5ba79
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
b414104
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
697032f
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
a304cd0
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
5af6371
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
11c2652
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
e29359f
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
64711a6
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
abf1c72
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
0db1bdc
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
676f7d2
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
e5b47f7
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
92f7229
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
66a1713
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
d6e0545
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
43706c5
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
bd1317e
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
f5b3a3f
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
88c9755
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
df9737b
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
105b13f
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
5cce6ee
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
f278778
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
51d66b5
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
dd21cbd
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
b2a438d
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
ea7a271
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
02a46f5
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
b2580bf
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
a6a8bf8
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
bf27016
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
95174ff
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
778071e
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
b80b3cc
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
6e1f65e
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
2ed32f0
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
ead510c
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
4f23b44
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
4d50248
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
836ae2f
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
1e09a64
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
81bf293
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
6a0d836
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
a580c09
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
cf73f85
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
cca64c0
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
1ff06ac
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
01ccaf2
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
33eea14
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
d89969b
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
d913b85
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
9042f30
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
5c3051f
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
49651b0
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
4f1839c
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
0089979
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
67b417b
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
75cb572
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
eda723d
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
7cdca9b
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
1d65972
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
61859a1
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
2216b38
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
1e4b496
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
4206212
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
b963c19
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
d0efccf
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
670f430
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
54ea3d9
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
66e2f0a
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
0075174
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
80a28d8
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
7bf9f23
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
992ff35
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
035c444
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
3310211
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
b4a7d98
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
ddf7222
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
f112ae9
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
e54ffa6
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
5099a98
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
97b4c73
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
c98ef1a
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
a54f5f3
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
ecb033b
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
547ba9c
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
963e286
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
6a1ed4e
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
d75f7b9
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
a442e52
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
bff0f77
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
eee0729
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
65ea119
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
90f8ebf
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
ac3730a
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
e9ff665
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
acf4f50
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
ea4a595
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
42d99d7
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
70a84e0
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
beb787d
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
153515f
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
2bca184
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
402fd6a
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
2b85997
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
ac3647b
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
34deeb2
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
cfb4238
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
d0baad4
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
f2701b2
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
d100974
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
e2cf2cb
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
e1a8f00
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
ceaa8bb
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
0895a9f
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
1237ce8
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
bd230b7
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
e321371
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
aae67e4
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
09e70a8
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
fffe27b
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
d4fba68
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
cecce34
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
abf5525
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
bc0ec7a
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
1efb4ab
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
24b84ef
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
be8e264
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
25261ab
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
c1e5fcd
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
f4c43cf
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
336425a
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
e97889d
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
ee49f08
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
f127eb9
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
82c9961
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
cc43636
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
0a5a808
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
d06fa91
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
f715ec2
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
af8a99f
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
09e8e92
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
232adfe
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
3800735
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
7397710
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
5b6f2ac
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
afbc5bf
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
7970b35
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
3ceab5e
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
a760ccd
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
00d532b
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
61abacb
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
872b1a0
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
2e87b7f
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
8e76ef1
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
0ead4a2
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
9116c1b
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
b6350a7
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
a56ccc9
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
a73d9a0
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
68b0508
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
7619feb
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
85e7706
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
ba5512b
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
4b6e88b
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
92f67ec
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
0f96410
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
af2448c
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
1385f94
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
6698356
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
c17b89c
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
03e392f
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
1ab06c2
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
52f3028
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
803b32f
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
4bd645d
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
5a5bf51
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
8407ff3
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
f9232bd
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
7ef9c16
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
3551e96
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
640fe86
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
af559b8
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
94a0718
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
e1c0506
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
2831ae9
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
09297c7
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
f06153d
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
4bfa465
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
4f34460
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
08ee9fc
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
a52da90
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
1cc4bd2
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
a352fb8
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
feea0a4
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
c109af8
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
aaf777c
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
9a00b27
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
7ec4c7f
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
6875ed1
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
b77c2af
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
f17532a
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
74e3cd2
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
b2221ef
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
9aabddd
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
47e40df
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
a458735
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
0e980dc
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
f717c74
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
1c5b99a
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
f0a1450
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
0988c99
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
ce374ea
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
da73cec
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
34466d7
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
86caf8a
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
fc74985
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
89e39ac
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
302150c
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
7dacfab
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
2cb2d7e
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
0aa8685
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
8e92647
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
4fff168
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
6c2154f
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
89b4bf9
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
2c80b5e
Update src/Request.php
gitauto-ai[bot] Dec 11, 2024
dd243c6
Delete src/Response.php
guibranco Dec 12, 2024
f428d57
Merge branch 'main' into gitauto/issue-264-20241211-000908
gstraccini[bot] Dec 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
112 changes: 38 additions & 74 deletions src/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,148 +3,112 @@
namespace GuiBranco\Pancake;

use stdClass;
use GuiBranco\Pancake\Response;

class Request
{
private function extractHeaders($header): array
{
$headers = array();

foreach (explode("\r\n", $header) as $i => $line) {
$result = $this->extractHeader($i, $line);
class Request {

Check warning

Code scanning / Phpcs (reported by Codacy)

Opening brace of a class must be on the line after the definition Warning

Opening brace of a class must be on the line after the definition
public function delete($url, $options = []) {

Check warning

Code scanning / Phpcs (reported by Codacy)

Incorrect spacing between argument "$options" and equals sign; expected 0 but found 1 Warning

Incorrect spacing between argument "$options" and equals sign; expected 0 but found 1

Check warning

Code scanning / Phpcs (reported by Codacy)

Missing doc comment for function delete() Warning

Missing doc comment for function delete()

Check warning

Code scanning / Phpcs (reported by Codacy)

Incorrect spacing between default value and equals sign for argument "$options"; expected 0 but found 1 Warning

Incorrect spacing between default value and equals sign for argument "$options"; expected 0 but found 1

Check warning

Code scanning / Phpcs (reported by Codacy)

Opening brace should be on a new line Warning

Opening brace should be on a new line

Check warning

Code scanning / Phpcs (reported by Codacy)

Expected 2 blank lines before function; 0 found Warning

Expected 2 blank lines before function; 0 found

if ($result === null) {
continue;
}

list($key, $value) = $result;
$headers[$key] = $value;
}

return $headers;
// Implementation here

Check warning

Code scanning / Phpcs (reported by Codacy)

Inline comments must end in full-stops, exclamation marks, or question marks Warning

Inline comments must end in full-stops, exclamation marks, or question marks
return Response::success(['data' => 'Sample data'], 'Request successful');
}
public function post($url, $data = [], $options = []) {

Check warning

Code scanning / Phpcs (reported by Codacy)

Incorrect spacing between argument "$data" and equals sign; expected 0 but found 1 Warning

Incorrect spacing between argument "$data" and equals sign; expected 0 but found 1

Check warning

Code scanning / Phpcs (reported by Codacy)

Incorrect spacing between default value and equals sign for argument "$options"; expected 0 but found 1 Warning

Incorrect spacing between default value and equals sign for argument "$options"; expected 0 but found 1

Check warning

Code scanning / Phpcs (reported by Codacy)

Incorrect spacing between argument "$options" and equals sign; expected 0 but found 1 Warning

Incorrect spacing between argument "$options" and equals sign; expected 0 but found 1

Check warning

Code scanning / Phpcs (reported by Codacy)

Missing doc comment for function post() Warning

Missing doc comment for function post()

Check warning

Code scanning / Phpcs (reported by Codacy)

Incorrect spacing between default value and equals sign for argument "$data"; expected 0 but found 1 Warning

Incorrect spacing between default value and equals sign for argument "$data"; expected 0 but found 1

Check warning

Code scanning / Phpcs (reported by Codacy)

Opening brace should be on a new line Warning

Opening brace should be on a new line
// Implementation here

Check warning

Code scanning / Phpcs (reported by Codacy)

Inline comments must end in full-stops, exclamation marks, or question marks Warning

Inline comments must end in full-stops, exclamation marks, or question marks
}

Check warning

Code scanning / Phpcs (reported by Codacy)

Line indented incorrectly; expected 4 spaces, found 8 Warning

Line indented incorrectly; expected 4 spaces, found 8

Check warning

Code scanning / Phpcs (reported by Codacy)

Closing brace indented incorrectly; expected 0 spaces, found 4 Warning

Closing brace indented incorrectly; expected 0 spaces, found 4

private function extractHeader($index, $line): ?array
{
if ($index === 0) {
return array("http_code", $line);
}

$explode = explode(": ", $line);

if (count($explode) != 2) {
return null;
}

list($key, $value) = $explode;
return array($key, $value);
}
return Response::error(400, 'Bad Request', ['error' => 'Invalid data']);

private function execute($fields): stdClass
{
$curl = curl_init();
curl_setopt_array($curl, $fields);
$response = curl_exec($curl);
$result = new stdCLass();
$result->url = $fields[CURLOPT_URL];

if ($response === false) {
$error = curl_error($curl);
curl_close($curl);

$result->statusCode = -1;
$result->error = $error;
return $result;
}
}
private function getFields($url, $headers): array {

Check warning

Code scanning / Phpcs (reported by Codacy)

Missing doc comment for function getFields() Warning

Missing doc comment for function getFields()

Check warning

Code scanning / Phpcs (reported by Codacy)

Opening brace should be on a new line Warning

Opening brace should be on a new line

Check warning

Code scanning / Phpcs (reported by Codacy)

Line indented incorrectly; expected 0 spaces, found 4 Warning

Line indented incorrectly; expected 0 spaces, found 4

Check warning

Code scanning / Phpcs (reported by Codacy)

Expected 2 blank lines before function; 0 found Warning

Expected 2 blank lines before function; 0 found
$fields = array(

Check warning

Code scanning / Phpcs (reported by Codacy)

Short array syntax must be used to define arrays Warning

Short array syntax must be used to define arrays
CURLOPT_URL => $url,

Check warning

Code scanning / Phpcs (reported by Codacy)

Array double arrow not aligned correctly; expected 12 spaces but found 1 Warning

Array double arrow not aligned correctly; expected 12 spaces but found 1

$headerSize = curl_getinfo($curl, CURLINFO_HEADER_SIZE);
$header = substr($response, 0, $headerSize);
$headers = $this->extractHeaders($header);
$body = substr($response, $headerSize);
$httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
curl_close($curl);

$result->statusCode = $httpCode;
$result->headers = $headers;
$result->body = $body;
return $result;
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_MAXREDIRS => 10,

Check warning

Code scanning / Phpcs (reported by Codacy)

Array key not aligned correctly; expected 19 spaces but found 12 Warning

Array key not aligned correctly; expected 19 spaces but found 12
CURLOPT_HEADER => true,

Check warning

Code scanning / Phpcs (reported by Codacy)

Array key not aligned correctly; expected 19 spaces but found 12 Warning

Array key not aligned correctly; expected 19 spaces but found 12

Check warning

Code scanning / Phpcs (reported by Codacy)

Array double arrow not aligned correctly; expected 9 spaces but found 1 Warning

Array double arrow not aligned correctly; expected 9 spaces but found 1
CURLOPT_TIMEOUT => 0,

Check warning

Code scanning / Phpcs (reported by Codacy)

Array key not aligned correctly; expected 19 spaces but found 12 Warning

Array key not aligned correctly; expected 19 spaces but found 12
CURLOPT_FOLLOWLOCATION => true,

Check warning

Code scanning / Phpcs (reported by Codacy)

Array double arrow not aligned correctly; expected 4 spaces but found 1 Warning

Array double arrow not aligned correctly; expected 4 spaces but found 1
CURLOPT_SSL_VERIFYPEER => false,
);
CURLOPT_SSL_VERIFYHOST => false,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_HTTPHEADER => $headers
}

private function getFields($url, $headers): array
{
return array(
return $fields;
CURLOPT_SSL_VERIFYPEER => false,
}
CURLOPT_SSL_VERIFYHOST => false,

Check notice on line 42 in src/Request.php

View check run for this annotation

codefactor.io / CodeFactor

src/Request.php#L42

Code after the RETURN statement on line 41 cannot be executed. (Squiz.PHP.NonExecutableCode)

Check notice on line 42 in src/Request.php

View check run for this annotation

codefactor.io / CodeFactor

src/Request.php#L42

Code after the RETURN statement on line 39 cannot be executed. (Squiz.PHP.NonExecutableCode)
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,

Check notice on line 43 in src/Request.php

View check run for this annotation

codefactor.io / CodeFactor

src/Request.php#L43

Code after the RETURN statement on line 39 cannot be executed. (Squiz.PHP.NonExecutableCode)
CURLOPT_HTTPHEADER => $headers
$options = array(

Check notice on line 45 in src/Request.php

View check run for this annotation

codefactor.io / CodeFactor

src/Request.php#L45

Code after the RETURN statement on line 28 cannot be executed. (Squiz.PHP.NonExecutableCode)

Check notice on line 45 in src/Request.php

View check run for this annotation

codefactor.io / CodeFactor

src/Request.php#L45

Code after the RETURN statement on line 39 cannot be executed. (Squiz.PHP.NonExecutableCode)

Check warning

Code scanning / Phpcs (reported by Codacy)

Short array syntax must be used to define arrays Warning

Short array syntax must be used to define arrays
CURLOPT_URL => $url,

Check notice on line 46 in src/Request.php

View check run for this annotation

codefactor.io / CodeFactor

src/Request.php#L46

Code after the RETURN statement on line 39 cannot be executed. (Squiz.PHP.NonExecutableCode)
CURLOPT_RETURNTRANSFER => true,

Check notice on line 47 in src/Request.php

View check run for this annotation

codefactor.io / CodeFactor

src/Request.php#L47

Code after the RETURN statement on line 39 cannot be executed. (Squiz.PHP.NonExecutableCode)
CURLOPT_HEADER => true,

Check notice on line 48 in src/Request.php

View check run for this annotation

codefactor.io / CodeFactor

src/Request.php#L48

Code after the RETURN statement on line 39 cannot be executed. (Squiz.PHP.NonExecutableCode)
CURLOPT_ENCODING => "",

Check notice on line 49 in src/Request.php

View check run for this annotation

codefactor.io / CodeFactor

src/Request.php#L49

Code after the RETURN statement on line 39 cannot be executed. (Squiz.PHP.NonExecutableCode)
CURLOPT_MAXREDIRS => 10,

Check notice on line 50 in src/Request.php

View check run for this annotation

codefactor.io / CodeFactor

src/Request.php#L50

Code after the RETURN statement on line 39 cannot be executed. (Squiz.PHP.NonExecutableCode)
CURLOPT_TIMEOUT => 0,

Check notice on line 51 in src/Request.php

View check run for this annotation

codefactor.io / CodeFactor

src/Request.php#L51

Code after the RETURN statement on line 39 cannot be executed. (Squiz.PHP.NonExecutableCode)
CURLOPT_FOLLOWLOCATION => true,

Check notice on line 52 in src/Request.php

View check run for this annotation

codefactor.io / CodeFactor

src/Request.php#L52

Code after the RETURN statement on line 39 cannot be executed. (Squiz.PHP.NonExecutableCode)
CURLOPT_SSL_VERIFYPEER => false,

Check notice on line 53 in src/Request.php

View check run for this annotation

codefactor.io / CodeFactor

src/Request.php#L53

Code after the RETURN statement on line 39 cannot be executed. (Squiz.PHP.NonExecutableCode)

Check warning

Code scanning / Phpcs (reported by Codacy)

Array key not aligned correctly; expected 20 spaces but found 12 Warning

Array key not aligned correctly; expected 20 spaces but found 12
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,

Check notice on line 54 in src/Request.php

View check run for this annotation

codefactor.io / CodeFactor

src/Request.php#L54

Code after the RETURN statement on line 39 cannot be executed. (Squiz.PHP.NonExecutableCode)
CURLOPT_SSL_VERIFYPEER => false,

Check notice on line 55 in src/Request.php

View check run for this annotation

codefactor.io / CodeFactor

src/Request.php#L55

Code after the RETURN statement on line 39 cannot be executed. (Squiz.PHP.NonExecutableCode)
CURLOPT_SSL_VERIFYHOST => false,

Check notice on line 56 in src/Request.php

View check run for this annotation

codefactor.io / CodeFactor

src/Request.php#L56

Code after the RETURN statement on line 52 cannot be executed. (Squiz.PHP.NonExecutableCode)

Check notice on line 56 in src/Request.php

View check run for this annotation

codefactor.io / CodeFactor

src/Request.php#L56

Code after the RETURN statement on line 39 cannot be executed. (Squiz.PHP.NonExecutableCode)
CURLOPT_SSL_VERIFYHOST => false,

Check notice on line 57 in src/Request.php

View check run for this annotation

codefactor.io / CodeFactor

src/Request.php#L57

Code after the RETURN statement on line 52 cannot be executed. (Squiz.PHP.NonExecutableCode)

Check notice on line 57 in src/Request.php

View check run for this annotation

codefactor.io / CodeFactor

src/Request.php#L57

Code after the RETURN statement on line 39 cannot be executed. (Squiz.PHP.NonExecutableCode)

Check warning

Code scanning / Phpcs (reported by Codacy)

Array key not aligned correctly; expected 20 spaces but found 12 Warning

Array key not aligned correctly; expected 20 spaces but found 12
CURLOPT_HTTPHEADER => $headers

Check notice on line 58 in src/Request.php

View check run for this annotation

codefactor.io / CodeFactor

src/Request.php#L58

Code after the RETURN statement on line 52 cannot be executed. (Squiz.PHP.NonExecutableCode)

Check notice on line 58 in src/Request.php

View check run for this annotation

codefactor.io / CodeFactor

src/Request.php#L58

Code after the RETURN statement on line 39 cannot be executed. (Squiz.PHP.NonExecutableCode)
);
}

public function get($url, $headers = array()): stdClass
{
$fields = $this->getFields($url, $headers);
return $this->execute($fields);
}
);

Check notice on line 60 in src/Request.php

View check run for this annotation

codefactor.io / CodeFactor

src/Request.php#L60

Code after the RETURN statement on line 52 cannot be executed. (Squiz.PHP.NonExecutableCode)

Check warning

Code scanning / Phpcs (reported by Codacy)

Closing parenthesis not aligned correctly; expected 19 spaces but found 8 Warning

Closing parenthesis not aligned correctly; expected 19 spaces but found 8
);

Check warning

Code scanning / Phpcs (reported by Codacy)

Line indented incorrectly; expected at least 8 spaces, found 4 Warning

Line indented incorrectly; expected at least 8 spaces, found 4
return $fields;

Check notice on line 62 in src/Request.php

View check run for this annotation

codefactor.io / CodeFactor

src/Request.php#L62

Code after the RETURN statement on line 39 cannot be executed. (Squiz.PHP.NonExecutableCode)

Check warning

Code scanning / Phpcs (reported by Codacy)

Line indented incorrectly; expected at least 12 spaces, found 8 Warning

Line indented incorrectly; expected at least 12 spaces, found 8
CURLOPT_HTTPHEADER => $headers

Check notice on line 63 in src/Request.php

View check run for this annotation

codefactor.io / CodeFactor

src/Request.php#L63

Code after the RETURN statement on line 52 cannot be executed. (Squiz.PHP.NonExecutableCode)

Check notice on line 63 in src/Request.php

View check run for this annotation

codefactor.io / CodeFactor

src/Request.php#L63

Code after the RETURN statement on line 39 cannot be executed. (Squiz.PHP.NonExecutableCode)

Check notice on line 63 in src/Request.php

View check run for this annotation

codefactor.io / CodeFactor

src/Request.php#L63

Code after the RETURN statement on line 62 cannot be executed. (Squiz.PHP.NonExecutableCode)

public function post($url, $headers = array(), $data = null): stdClass
{
$fields = $this->getFields($url, $headers);
$fields[CURLOPT_CUSTOMREQUEST] = "POST";

Check notice on line 66 in src/Request.php

View check run for this annotation

codefactor.io / CodeFactor

src/Request.php#L66

Code after the RETURN statement on line 62 cannot be executed. (Squiz.PHP.NonExecutableCode)
if ($data !== null) {

Check notice on line 67 in src/Request.php

View check run for this annotation

codefactor.io / CodeFactor

src/Request.php#L67

Code after the RETURN statement on line 62 cannot be executed. (Squiz.PHP.NonExecutableCode)
$fields[CURLOPT_POSTFIELDS] = $data;

Check notice on line 68 in src/Request.php

View check run for this annotation

codefactor.io / CodeFactor

src/Request.php#L68

Code after the RETURN statement on line 62 cannot be executed. (Squiz.PHP.NonExecutableCode)
}

return $this->execute($fields);

Check notice on line 70 in src/Request.php

View check run for this annotation

codefactor.io / CodeFactor

src/Request.php#L70

Code after the RETURN statement on line 62 cannot be executed. (Squiz.PHP.NonExecutableCode)
}

Check warning

Code scanning / Phpcs (reported by Codacy)

Expected //end head() Warning

Expected //end head()

Check notice on line 72 in src/Request.php

View check run for this annotation

codefactor.io / CodeFactor

src/Request.php#L72

Code after the RETURN statement on line 52 cannot be executed. (Squiz.PHP.NonExecutableCode)
public function put($url, $headers = array(), $data = null): stdClass

Check notice on line 73 in src/Request.php

View check run for this annotation

codefactor.io / CodeFactor

src/Request.php#L73

Code after the RETURN statement on line 62 cannot be executed. (Squiz.PHP.NonExecutableCode)
{
$fields = $this->getFields($url, $headers);
$fields[CURLOPT_CUSTOMREQUEST] = "PUT";

Check warning

Code scanning / Phpcs (reported by Codacy)

Array double arrow not aligned correctly; expected 15 spaces but found 1 Warning

Array double arrow not aligned correctly; expected 15 spaces but found 1
if ($data !== null) {

Check warning

Code scanning / Phpcs (reported by Codacy)

Array key not aligned correctly; expected 16 spaces but found 12 Warning

Array key not aligned correctly; expected 16 spaces but found 12
$fields[CURLOPT_POSTFIELDS] = $data;
}
return $this->execute($fields);

Check warning

Code scanning / Phpcs (reported by Codacy)

Array double arrow not aligned correctly; expected 9 spaces but found 1 Warning

Array double arrow not aligned correctly; expected 9 spaces but found 1
}

Check warning

Code scanning / Phpcs (reported by Codacy)

Array key not aligned correctly; expected 16 spaces but found 12 Warning

Array key not aligned correctly; expected 16 spaces but found 12

public function delete($url, $headers = array(), $data = null): stdClass

Check notice on line 82 in src/Request.php

View check run for this annotation

codefactor.io / CodeFactor

src/Request.php#L82

Code after the RETURN statement on line 52 cannot be executed. (Squiz.PHP.NonExecutableCode)

Check notice on line 82 in src/Request.php

View check run for this annotation

codefactor.io / CodeFactor

src/Request.php#L82

Code after the RETURN statement on line 62 cannot be executed. (Squiz.PHP.NonExecutableCode)
{

Check warning

Code scanning / Phpcs (reported by Codacy)

Array double arrow not aligned correctly; expected 6 spaces but found 1 Warning

Array double arrow not aligned correctly; expected 6 spaces but found 1

Check warning

Code scanning / Phpcs (reported by Codacy)

Array key not aligned correctly; expected 16 spaces but found 12 Warning

Array key not aligned correctly; expected 16 spaces but found 12
$fields = $this->getFields($url, $headers);

Check warning

Code scanning / Phpcs (reported by Codacy)

Array key not aligned correctly; expected 16 spaces but found 12 Warning

Array key not aligned correctly; expected 16 spaces but found 12
$fields[CURLOPT_CUSTOMREQUEST] = "DELETE";
if ($data !== null) {
$fields[CURLOPT_POSTFIELDS] = $data;

Check warning

Code scanning / Phpcs (reported by Codacy)

Closing parenthesis not aligned correctly; expected 15 spaces but found 8 Warning

Closing parenthesis not aligned correctly; expected 15 spaces but found 8
}
return $this->execute($fields);
}

public function patch($url, $headers = array(), $data = null): stdClass

Check notice on line 92 in src/Request.php

View check run for this annotation

codefactor.io / CodeFactor

src/Request.php#L92

Code after the RETURN statement on line 52 cannot be executed. (Squiz.PHP.NonExecutableCode)

Check notice on line 92 in src/Request.php

View check run for this annotation

codefactor.io / CodeFactor

src/Request.php#L92

Code after the RETURN statement on line 62 cannot be executed. (Squiz.PHP.NonExecutableCode)
{
$fields = $this->getFields($url, $headers);
$fields[CURLOPT_CUSTOMREQUEST] = "PATCH";
if ($data !== null) {
$fields[CURLOPT_POSTFIELDS] = $data;
}
return $this->execute($fields);

Check notice on line 99 in src/Request.php

View check run for this annotation

codefactor.io / CodeFactor

src/Request.php#L99

Code after the RETURN statement on line 52 cannot be executed. (Squiz.PHP.NonExecutableCode)
}

public function options($url, $headers = array()): stdClass

Check notice on line 102 in src/Request.php

View check run for this annotation

codefactor.io / CodeFactor

src/Request.php#L102

Code after the RETURN statement on line 62 cannot be executed. (Squiz.PHP.NonExecutableCode)
{
$fields = $this->getFields($url, $headers);

Check warning

Code scanning / Phpcs (reported by Codacy)

Expected //end patch() Warning

Expected //end patch()
$fields[CURLOPT_CUSTOMREQUEST] = "OPTIONS";
return $this->execute($fields);
}

public function head($url, $headers = array()): stdClass

Check notice on line 109 in src/Request.php

View check run for this annotation

codefactor.io / CodeFactor

src/Request.php#L109

Code after the RETURN statement on line 62 cannot be executed. (Squiz.PHP.NonExecutableCode)
{
$fields = $this->getFields($url, $headers);
$fields[CURLOPT_CUSTOMREQUEST] = "HEAD";
$fields[CURLOPT_NOBODY] = true;
return $this->execute($fields);
}
}
Loading