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
Show file tree
Hide file tree
Changes from 9 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
26 changes: 22 additions & 4 deletions src/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,47 @@
namespace GuiBranco\Pancake;

use stdClass;
use GuiBranco\Pancake\Response;

class Request
{
private function extractHeaders($header): array
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 get($url, $options = [])

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

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)

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)

Missing doc comment for function get() Warning

Missing doc comment for function get()
{
$headers = array();
// Simulate a successful response

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)

Missing doc comment for function post() Warning

Missing doc comment for function post()

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)

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
{
// Simulate an error response

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::error(400, 'Bad Request', ['error' => 'Invalid data']);
}
public function put($url, $data = [], $options = []) {

Check warning

Code scanning / Phpcs (reported by Codacy)

Missing doc comment for function put() Warning

Missing doc comment for function put()

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 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)

Opening brace should be on a new line Warning

Opening brace should be on a new line
public function put($url, $data = [], $options = []) {

Check warning

Code scanning / Phpcs (reported by Codacy)

Missing doc comment for function put() Warning

Missing doc comment for function put()

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; 1 found Warning

Expected 2 blank lines before function; 1 found

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 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)

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 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)

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)

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 "$data"; expected 0 but found 1 Warning

Incorrect spacing between default value and equals sign for argument "$data"; expected 0 but found 1
// Simulate a successful response

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 at least 12 spaces, found 8 Warning

Line indented incorrectly; expected at least 12 spaces, found 8
return Response::success(['data' => 'Updated data'], 'Update successful');

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
}
}

Check warning

Code scanning / Phpcs (reported by Codacy)

Expected 2 blank lines after function; 1 found Warning

Expected 2 blank lines after function; 1 found

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)

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)

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)

Missing member variable doc comment Warning

Missing member variable doc comment

Check warning

Code scanning / Phpcs (reported by Codacy)

There must be 1 space after the property type declaration; 0 found Warning

There must be 1 space after the property type declaration; 0 found

Check warning

Code scanning / Phpcs (reported by Codacy)

Visibility must be declared on property "$header" Warning

Visibility must be declared on property "$header"

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)

There must not be more than one property declared per statement Warning

There must not be more than one property declared per statement

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

Check warning

Code scanning / Phpcs (reported by Codacy)

Expected //end setSSLVerification() Warning

Expected //end setSSLVerification()

Check warning

Code scanning / Phpcs (reported by Codacy)

Expected 1 blank line(s) before member var; 0 found Warning

Expected 1 blank line(s) before member var; 0 found

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

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 8 spaces, found 12 Warning

Line indented incorrectly; expected 8 spaces, found 12
foreach (explode("\r\n", $header) as $i => $line) {

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
public function delete($url, $options = []) {
// Simulate an error response
return Response::error(404, 'Not Found', ['error' => 'Resource not found']);

Check warning

Code scanning / Phpcs (reported by Codacy)

Array with multiple values cannot be declared on a single line Warning

Array with multiple values cannot be declared on a single line

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
}
$result = $this->extractHeader($i, $line);

Check warning

Code scanning / Phpcs (reported by Codacy)

Missing member variable doc comment Warning

Missing member variable doc comment

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

Check warning

Code scanning / Phpcs (reported by Codacy)

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

Closing brace indented incorrectly; expected 8 spaces, found 4
}

Check warning

Code scanning / Phpcs (reported by Codacy)

Visibility must be declared on property "$key" Warning

Visibility must be declared on property "$key"

Check warning

Code scanning / Phpcs (reported by Codacy)

Missing member variable doc comment Warning

Missing member variable doc comment

Check warning

Code scanning / Phpcs (reported by Codacy)

There must not be more than one property declared per statement Warning

There must not be more than one property declared per statement

Check warning

Code scanning / Phpcs (reported by Codacy)

Missing member variable doc comment Warning

Missing member variable doc comment
list($key, $value) = $result;
$headers[$key] = $value;
}

Check warning

Code scanning / Phpcs (reported by Codacy)

Expected 2 blank lines after function; 1 found Warning

Expected 2 blank lines after function; 1 found
return $headers;
}

private function extractHeader($index, $line): ?array

Check warning

Code scanning / Phpcs (reported by Codacy)

The use of function curl_init() is discouraged Warning

The use of function curl_init() is discouraged
{

Check warning

Code scanning / Phpcs (reported by Codacy)

The use of function curl_setopt_array() is discouraged Warning

The use of function curl_setopt_array() is discouraged
if ($index === 0) {
return array("http_code", $line);
}
Expand Down Expand Up @@ -67,23 +85,23 @@
$result->statusCode = $httpCode;
$result->headers = $headers;
$result->body = $body;
return $result;

Check warning

Code scanning / Phpcs (reported by Codacy)

Expected //end executeBatch() Warning

Expected //end executeBatch()
}

private function getFields($url, $headers): array
{
return array(
CURLOPT_URL => $url,

Check warning

Code scanning / Phpcs (reported by Codacy)

Expected 2 blank lines after function; 1 found Warning

Expected 2 blank lines after function; 1 found
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HEADER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,

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
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_SSL_VERIFYHOST => false,
CURLOPT_HTTPHEADER => $headers

Check warning

Code scanning / Phpcs (reported by Codacy)

Expected 2 blank lines after function; 1 found Warning

Expected 2 blank lines after function; 1 found
);
}

Expand All @@ -93,7 +111,7 @@
return $this->execute($fields);
}

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

Check warning

Code scanning / Phpcs (reported by Codacy)

Expected 1 blank line before closing function brace; 0 found Warning

Expected 1 blank line before closing function brace; 0 found

Check warning

Code scanning / Phpcs (reported by Codacy)

Expected //end handleResponse() Warning

Expected //end handleResponse()
{
$fields = $this->getFields($url, $headers);
$fields[CURLOPT_CUSTOMREQUEST] = "POST";
Expand All @@ -103,7 +121,7 @@
return $this->execute($fields);
}

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

Check warning

Code scanning / Phpcs (reported by Codacy)

Expected //end put() Warning

Expected //end put()

Check warning

Code scanning / Phpcs (reported by Codacy)

Expected 1 blank line before closing function brace; 0 found Warning

Expected 1 blank line before closing function brace; 0 found
{
$fields = $this->getFields($url, $headers);
$fields[CURLOPT_CUSTOMREQUEST] = "PUT";
Expand All @@ -113,7 +131,7 @@
return $this->execute($fields);
}

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

Check warning

Code scanning / Phpcs (reported by Codacy)

Expected 1 blank line before closing function brace; 0 found Warning

Expected 1 blank line before closing function brace; 0 found

Check warning

Code scanning / Phpcs (reported by Codacy)

Expected //end get() Warning

Expected //end get()
{
$fields = $this->getFields($url, $headers);
$fields[CURLOPT_CUSTOMREQUEST] = "DELETE";
Expand All @@ -123,7 +141,7 @@
return $this->execute($fields);
}

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

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
{
$fields = $this->getFields($url, $headers);
$fields[CURLOPT_CUSTOMREQUEST] = "PATCH";
Expand Down
25 changes: 25 additions & 0 deletions src/Response.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

namespace GuiBranco\Pancake;

class Response
{
public static function success($data, $message = 'Success')

Check warning

Code scanning / Phpcs (reported by Codacy)

Missing doc comment for function success() Warning

Missing doc comment for function success()

Check warning

Code scanning / Phpcs (reported by Codacy)

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

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

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

Check warning

Code scanning / Phpcs (reported by Codacy)

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

Incorrect spacing between argument "$message" and equals sign; expected 0 but found 1
{
return [
'status' => 'success',

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

Check warning

Code scanning / Phpcs (reported by Codacy)

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

Array double arrow not aligned correctly; expected 2 spaces but found 1
'message' => $message,

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
'data' => $data

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

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
];

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
}

Check warning

Code scanning / Phpcs (reported by Codacy)

Expected 2 blank lines after function; 1 found Warning

Expected 2 blank lines after function; 1 found

Check warning

Code scanning / Phpcs (reported by Codacy)

Expected //end getUrl() Warning

Expected //end getUrl()

Check warning

Code scanning / Phpcs (reported by Codacy)

Expected 1 blank line before closing function brace; 0 found Warning

Expected 1 blank line before closing function brace; 0 found

public static function error($code, $message, $details = [])

Check warning

Code scanning / Phpcs (reported by Codacy)

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

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

Check warning

Code scanning / Phpcs (reported by Codacy)

Missing doc comment for function error() Warning

Missing doc comment for function error()

Check warning

Code scanning / Phpcs (reported by Codacy)

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

Incorrect spacing between argument "$details" and equals sign; expected 0 but found 1
{
return [
'status' => 'error',

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

Check warning

Code scanning / Phpcs (reported by Codacy)

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

Array double arrow not aligned correctly; expected 2 spaces but found 1
'code' => $code,

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

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
'message' => $message,

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
'details' => $details

Check warning

Code scanning / Phpcs (reported by Codacy)

Each line in an array declaration must end in a comma Warning

Each line in an array declaration must end in a comma

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
];

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
}

Check warning

Code scanning / Phpcs (reported by Codacy)

Expected 1 blank line before closing function brace; 0 found Warning

Expected 1 blank line before closing function brace; 0 found

Check warning

Code scanning / Phpcs (reported by Codacy)

Expected //end toJson() Warning

Expected //end toJson()

Check warning

Code scanning / Phpcs (reported by Codacy)

Expected 2 blank lines after function; 1 found Warning

Expected 2 blank lines after function; 1 found
}

Check warning

Code scanning / Phpcs (reported by Codacy)

Expected //end getBodyAsArray() Warning

Expected //end getBodyAsArray()
Loading