Test Setup Failed
Pull Request — master (#9)
by
unknown
13:59
created
src/Endpoints/TransferRecipient.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
      */
30 30
     public function createBulk(array $payload): self
31 31
     {
32
-        $this->post($this->url(self::ENDPOINT).'/bulk', $payload);
32
+        $this->post($this->url(self::ENDPOINT) . '/bulk', $payload);
33 33
 
34 34
         return $this;
35 35
     }
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
      *
42 42
      * @link https://paystack.com/docs/api/#transfer-recipient-list
43 43
      */
44
-    public function list(array $query = []): self
44
+    public function list(array $query = [ ]): self
45 45
     {
46 46
         $this->get($this->url(self::ENDPOINT), $query);
47 47
 
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
      */
56 56
     public function fetch(string $recipient_code): self
57 57
     {
58
-        $this->get($this->url(self::ENDPOINT).'/'.$recipient_code);
58
+        $this->get($this->url(self::ENDPOINT) . '/' . $recipient_code);
59 59
 
60 60
         return $this;
61 61
     }
@@ -67,9 +67,9 @@  discard block
 block discarded – undo
67 67
      *
68 68
      * @link https://paystack.com/docs/api/#transfer-recipient-update
69 69
      */
70
-    public function update(string $recipient_code, array $payload = []): self
70
+    public function update(string $recipient_code, array $payload = [ ]): self
71 71
     {
72
-        $this->put($this->url(self::ENDPOINT).'/'.$recipient_code, $payload);
72
+        $this->put($this->url(self::ENDPOINT) . '/' . $recipient_code, $payload);
73 73
 
74 74
         return $this;
75 75
     }
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
      */
82 82
     public function deactivate(string $recipient_code): self
83 83
     {
84
-        $this->delete($this->url(self::ENDPOINT).'/'.$recipient_code);
84
+        $this->delete($this->url(self::ENDPOINT) . '/' . $recipient_code);
85 85
 
86 86
         return $this;
87 87
     }
Please login to merge, or discard this patch.
src/Endpoints/Endpoint.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 
72 72
     protected function url(string $endpoint): string
73 73
     {
74
-        return self::BASE_URL.ltrim($endpoint, '/');
74
+        return self::BASE_URL . ltrim($endpoint, '/');
75 75
     }
76 76
 
77 77
     /**
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
      *
84 84
      * @throws PaystackApiException
85 85
      */
86
-    protected function get(string $url, array|string|null $query = []): self
86
+    protected function get(string $url, array | string | null $query = [ ]): self
87 87
     {
88 88
         try {
89 89
             $connection = $this->paystack->getConnection();
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
             $response = $connection->get($url, $query);
95 95
             $this->response = $response;
96 96
 
97
-            if (! $response->successful()) {
97
+            if (!$response->successful()) {
98 98
                 $this->handleErrorResponse($response, $url);
99 99
             }
100 100
 
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
      *
114 114
      * @throws PaystackApiException
115 115
      */
116
-    protected function post(string $url, array $payload = []): self
116
+    protected function post(string $url, array $payload = [ ]): self
117 117
     {
118 118
         try {
119 119
             $connection = $this->paystack->getConnection();
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
             $response = $connection->post($url, $payload);
125 125
             $this->response = $response;
126 126
 
127
-            if (! $response->successful()) {
127
+            if (!$response->successful()) {
128 128
                 $this->handleErrorResponse($response, $url);
129 129
             }
130 130
 
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
      *
144 144
      * @throws PaystackApiException
145 145
      */
146
-    protected function put(string $url, array $payload = []): self
146
+    protected function put(string $url, array $payload = [ ]): self
147 147
     {
148 148
         try {
149 149
             $connection = $this->paystack->getConnection();
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
             $response = $connection->put($url, $payload);
155 155
             $this->response = $response;
156 156
 
157
-            if (! $response->successful()) {
157
+            if (!$response->successful()) {
158 158
                 $this->handleErrorResponse($response, $url);
159 159
             }
160 160
 
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
      *
174 174
      * @throws PaystackApiException
175 175
      */
176
-    protected function delete(string $url, array $payload = []): self
176
+    protected function delete(string $url, array $payload = [ ]): self
177 177
     {
178 178
         try {
179 179
             $connection = $this->paystack->getConnection();
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
             $response = $connection->delete($url, $payload);
185 185
             $this->response = $response;
186 186
 
187
-            if (! $response->successful()) {
187
+            if (!$response->successful()) {
188 188
                 $this->handleErrorResponse($response, $url);
189 189
             }
190 190
 
@@ -224,15 +224,15 @@  discard block
 block discarded – undo
224 224
      */
225 225
     protected function validateRequired(array $data, array $required): void
226 226
     {
227
-        $errors = [];
227
+        $errors = [ ];
228 228
 
229 229
         foreach ($required as $field) {
230
-            if (! isset($data[$field]) || empty($data[$field])) {
231
-                $errors[$field] = "The {$field} field is required.";
230
+            if (!isset($data[ $field ]) || empty($data[ $field ])) {
231
+                $errors[ $field ] = "The {$field} field is required.";
232 232
             }
233 233
         }
234 234
 
235
-        if (! empty($errors)) {
235
+        if (!empty($errors)) {
236 236
             throw new PaystackValidationException('Validation failed', $errors);
237 237
         }
238 238
     }
Please login to merge, or discard this patch.
src/Endpoints/Settlement.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
      *
14 14
      * @link https://paystack.com/docs/api/#settlement-list
15 15
      */
16
-    public function list(array $query = []): self
16
+    public function list(array $query = [ ]): self
17 17
     {
18 18
         $this->get($this->url(self::ENDPOINT), $query);
19 19
 
@@ -27,9 +27,9 @@  discard block
 block discarded – undo
27 27
      *
28 28
      * @link https://paystack.com/docs/api/#settlement-fetch
29 29
      */
30
-    public function fetch(string $settlement_id, array $query = []): self
30
+    public function fetch(string $settlement_id, array $query = [ ]): self
31 31
     {
32
-        $this->get($this->url(self::ENDPOINT).'/'.$settlement_id, $query);
32
+        $this->get($this->url(self::ENDPOINT) . '/' . $settlement_id, $query);
33 33
 
34 34
         return $this;
35 35
     }
Please login to merge, or discard this patch.
src/Endpoints/Transaction.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
      */
16 16
     public function initialize(array $payload): self
17 17
     {
18
-        $this->post($this->url(self::ENDPOINT).'/initialize', $payload);
18
+        $this->post($this->url(self::ENDPOINT) . '/initialize', $payload);
19 19
 
20 20
         return $this;
21 21
     }
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
      */
36 36
     public function verify(string $reference): self
37 37
     {
38
-        $this->get($this->url(self::ENDPOINT).'/verify/'.$reference);
38
+        $this->get($this->url(self::ENDPOINT) . '/verify/' . $reference);
39 39
 
40 40
         return $this;
41 41
     }
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
      */
46 46
     public function status(string $reference = ''): string
47 47
     {
48
-        if (! empty($reference)) {
48
+        if (!empty($reference)) {
49 49
             return $this->verify($reference)->status();
50 50
         } else {
51 51
             return $this->response?->json('data.status') ?? '';
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
      *
60 60
      * @link https://paystack.com/docs/api/#transaction-list
61 61
      */
62
-    public function list(array $query = []): self
62
+    public function list(array $query = [ ]): self
63 63
     {
64 64
         $this->get($this->url(self::ENDPOINT), $query);
65 65
 
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
      */
74 74
     public function fetch(int $transaction_id): self
75 75
     {
76
-        $this->get($this->url(self::ENDPOINT).'/'.$transaction_id);
76
+        $this->get($this->url(self::ENDPOINT) . '/' . $transaction_id);
77 77
 
78 78
         return $this;
79 79
     }
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
      */
88 88
     public function chargeAuthorization(array $payload): self
89 89
     {
90
-        $this->post($this->url(self::ENDPOINT).'/charge_authorization', $payload);
90
+        $this->post($this->url(self::ENDPOINT) . '/charge_authorization', $payload);
91 91
 
92 92
         return $this;
93 93
     }
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
      */
102 102
     public function checkAuthorization(array $payload): self
103 103
     {
104
-        $this->post($this->url(self::ENDPOINT).'/check_authorization', $payload);
104
+        $this->post($this->url(self::ENDPOINT) . '/check_authorization', $payload);
105 105
 
106 106
         return $this;
107 107
     }
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
      */
114 114
     public function timeline(string $reference): self
115 115
     {
116
-        $this->get($this->url(self::ENDPOINT).'/timeline/'.$reference);
116
+        $this->get($this->url(self::ENDPOINT) . '/timeline/' . $reference);
117 117
 
118 118
         return $this;
119 119
     }
@@ -125,9 +125,9 @@  discard block
 block discarded – undo
125 125
      *
126 126
      * @link https://paystack.com/docs/api/#transaction-totals
127 127
      */
128
-    public function totals(array $query = []): self
128
+    public function totals(array $query = [ ]): self
129 129
     {
130
-        $this->get($this->url(self::ENDPOINT).'/totals', $query);
130
+        $this->get($this->url(self::ENDPOINT) . '/totals', $query);
131 131
 
132 132
         return $this;
133 133
     }
@@ -139,9 +139,9 @@  discard block
 block discarded – undo
139 139
      *
140 140
      * @link https://paystack.com/docs/api/#transaction-export
141 141
      */
142
-    public function export(array $query = []): self
142
+    public function export(array $query = [ ]): self
143 143
     {
144
-        $this->get($this->url(self::ENDPOINT).'/export', $query);
144
+        $this->get($this->url(self::ENDPOINT) . '/export', $query);
145 145
 
146 146
         return $this;
147 147
     }
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
      */
156 156
     public function partialDebit(array $payload): self
157 157
     {
158
-        $this->post($this->url(self::ENDPOINT).'/partial_debit', $payload);
158
+        $this->post($this->url(self::ENDPOINT) . '/partial_debit', $payload);
159 159
 
160 160
         return $this;
161 161
     }
Please login to merge, or discard this patch.
src/Endpoints/Subscription.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
      *
28 28
      * @link https://paystack.com/docs/api/#subscription-list
29 29
      */
30
-    public function list(array $query = []): self
30
+    public function list(array $query = [ ]): self
31 31
     {
32 32
         $this->get($this->url(self::ENDPOINT), $query);
33 33
 
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
      */
42 42
     public function fetch(string $subscription_code): self
43 43
     {
44
-        $this->get($this->url(self::ENDPOINT).'/'.$subscription_code);
44
+        $this->get($this->url(self::ENDPOINT) . '/' . $subscription_code);
45 45
 
46 46
         return $this;
47 47
     }
@@ -53,9 +53,9 @@  discard block
 block discarded – undo
53 53
      *
54 54
      * @link https://paystack.com/docs/api/#subscription-enable
55 55
      */
56
-    public function enable(array $payload = []): self
56
+    public function enable(array $payload = [ ]): self
57 57
     {
58
-        $this->post($this->url(self::ENDPOINT).'/enable', $payload);
58
+        $this->post($this->url(self::ENDPOINT) . '/enable', $payload);
59 59
 
60 60
         return $this;
61 61
     }
@@ -67,9 +67,9 @@  discard block
 block discarded – undo
67 67
      *
68 68
      * @link https://paystack.com/docs/api/#subscription-disable
69 69
      */
70
-    public function disable(array $payload = []): self
70
+    public function disable(array $payload = [ ]): self
71 71
     {
72
-        $this->post($this->url(self::ENDPOINT).'/disable', $payload);
72
+        $this->post($this->url(self::ENDPOINT) . '/disable', $payload);
73 73
 
74 74
         return $this;
75 75
     }
Please login to merge, or discard this patch.
src/Endpoints/Transfer.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
      */
30 30
     public function finalize(array $payload): self
31 31
     {
32
-        $this->post($this->url(self::ENDPOINT).'/finalize_transfer', $payload);
32
+        $this->post($this->url(self::ENDPOINT) . '/finalize_transfer', $payload);
33 33
 
34 34
         return $this;
35 35
     }
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
      */
44 44
     public function bulk(array $payload): self
45 45
     {
46
-        $this->post($this->url(self::ENDPOINT).'/bulk', $payload);
46
+        $this->post($this->url(self::ENDPOINT) . '/bulk', $payload);
47 47
 
48 48
         return $this;
49 49
     }
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
      *
56 56
      * @link https://paystack.com/docs/api/#transfer-list
57 57
      */
58
-    public function list(array $query = []): self
58
+    public function list(array $query = [ ]): self
59 59
     {
60 60
         $this->get($this->url(self::ENDPOINT), $query);
61 61
 
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
      */
70 70
     public function fetch(string $transfer_code): self
71 71
     {
72
-        $this->get($this->url(self::ENDPOINT).'/'.$transfer_code);
72
+        $this->get($this->url(self::ENDPOINT) . '/' . $transfer_code);
73 73
 
74 74
         return $this;
75 75
     }
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
      */
82 82
     public function verify(string $transfer_code): self
83 83
     {
84
-        $this->get($this->url(self::ENDPOINT).'/verify/'.$transfer_code);
84
+        $this->get($this->url(self::ENDPOINT) . '/verify/' . $transfer_code);
85 85
 
86 86
         return $this;
87 87
     }
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
      */
96 96
     public function resendOtp(array $payload): self
97 97
     {
98
-        $this->post($this->url(self::ENDPOINT).'/resend_otp', $payload);
98
+        $this->post($this->url(self::ENDPOINT) . '/resend_otp', $payload);
99 99
 
100 100
         return $this;
101 101
     }
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
      */
110 110
     public function disableOtp(array $payload): self
111 111
     {
112
-        $this->post($this->url(self::ENDPOINT).'/disable_otp', $payload);
112
+        $this->post($this->url(self::ENDPOINT) . '/disable_otp', $payload);
113 113
 
114 114
         return $this;
115 115
     }
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
      */
124 124
     public function disableOtpFinalize(array $payload): self
125 125
     {
126
-        $this->post($this->url(self::ENDPOINT).'/disable_otp_finalize', $payload);
126
+        $this->post($this->url(self::ENDPOINT) . '/disable_otp_finalize', $payload);
127 127
 
128 128
         return $this;
129 129
     }
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
      */
136 136
     public function enableOtp(): self
137 137
     {
138
-        $this->post($this->url(self::ENDPOINT).'/enable_otp');
138
+        $this->post($this->url(self::ENDPOINT) . '/enable_otp');
139 139
 
140 140
         return $this;
141 141
     }
Please login to merge, or discard this patch.
src/Endpoints/Resolve.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@
 block discarded – undo
41 41
      */
42 42
     public function card(string $card_bin): self
43 43
     {
44
-        $this->get($this->url('decision/bin/'.$card_bin));
44
+        $this->get($this->url('decision/bin/' . $card_bin));
45 45
 
46 46
         return $this;
47 47
     }
Please login to merge, or discard this patch.
src/Endpoints/Invoice.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
      *
28 28
      * @link https://paystack.com/docs/api/#payment-request-list
29 29
      */
30
-    public function list(array $query = []): self
30
+    public function list(array $query = [ ]): self
31 31
     {
32 32
         $this->get($this->url(self::ENDPOINT), $query);
33 33
 
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
      */
42 42
     public function fetch(string $invoice_id): self
43 43
     {
44
-        $this->get($this->url(self::ENDPOINT).'/'.$invoice_id);
44
+        $this->get($this->url(self::ENDPOINT) . '/' . $invoice_id);
45 45
 
46 46
         return $this;
47 47
     }
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
      */
54 54
     public function verify(string $invoice_code): self
55 55
     {
56
-        $this->get($this->url(self::ENDPOINT).'/verify/'.$invoice_code);
56
+        $this->get($this->url(self::ENDPOINT) . '/verify/' . $invoice_code);
57 57
 
58 58
         return $this;
59 59
     }
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
      */
66 66
     public function notify(string $invoice_code): self
67 67
     {
68
-        $this->post($this->url(self::ENDPOINT).'/notify/'.$invoice_code);
68
+        $this->post($this->url(self::ENDPOINT) . '/notify/' . $invoice_code);
69 69
 
70 70
         return $this;
71 71
     }
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
      */
78 78
     public function totals(): self
79 79
     {
80
-        $this->post($this->url(self::ENDPOINT).'/totals');
80
+        $this->post($this->url(self::ENDPOINT) . '/totals');
81 81
 
82 82
         return $this;
83 83
     }
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
      */
90 90
     public function finalize(string $invoice_code): self
91 91
     {
92
-        $this->post($this->url(self::ENDPOINT).'/finalize/'.$invoice_code);
92
+        $this->post($this->url(self::ENDPOINT) . '/finalize/' . $invoice_code);
93 93
 
94 94
         return $this;
95 95
     }
@@ -101,9 +101,9 @@  discard block
 block discarded – undo
101 101
      *
102 102
      * @link https://paystack.com/docs/api/#payment-request-update
103 103
      */
104
-    public function update(string $invoice_id, array $payload = []): self
104
+    public function update(string $invoice_id, array $payload = [ ]): self
105 105
     {
106
-        $this->put($this->url(self::ENDPOINT).'/'.$invoice_id, $payload);
106
+        $this->put($this->url(self::ENDPOINT) . '/' . $invoice_id, $payload);
107 107
 
108 108
         return $this;
109 109
     }
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
      */
116 116
     public function archive(string $invoice_code): self
117 117
     {
118
-        $this->post($this->url(self::ENDPOINT).'/archive/'.$invoice_code);
118
+        $this->post($this->url(self::ENDPOINT) . '/archive/' . $invoice_code);
119 119
 
120 120
         return $this;
121 121
     }
Please login to merge, or discard this patch.
src/Endpoints/Page.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
      *
28 28
      * @link https://paystack.com/docs/api/#page-list
29 29
      */
30
-    public function list(array $query = []): self
30
+    public function list(array $query = [ ]): self
31 31
     {
32 32
         $this->get($this->url(self::ENDPOINT), $query);
33 33
 
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
      */
42 42
     public function fetch(string $page_id): self
43 43
     {
44
-        $this->get($this->url(self::ENDPOINT).'/'.$page_id);
44
+        $this->get($this->url(self::ENDPOINT) . '/' . $page_id);
45 45
 
46 46
         return $this;
47 47
     }
@@ -53,9 +53,9 @@  discard block
 block discarded – undo
53 53
      *
54 54
      * @link https://paystack.com/docs/api/#page-update
55 55
      */
56
-    public function update(string $page_id, array $payload = []): self
56
+    public function update(string $page_id, array $payload = [ ]): self
57 57
     {
58
-        $this->put($this->url(self::ENDPOINT).'/'.$page_id, $payload);
58
+        $this->put($this->url(self::ENDPOINT) . '/' . $page_id, $payload);
59 59
 
60 60
         return $this;
61 61
     }
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
      */
68 68
     public function checkSlug(string $slug): self
69 69
     {
70
-        $this->get($this->url(self::ENDPOINT).'/check_slug_availability/'.$slug);
70
+        $this->get($this->url(self::ENDPOINT) . '/check_slug_availability/' . $slug);
71 71
 
72 72
         return $this;
73 73
     }
@@ -79,9 +79,9 @@  discard block
 block discarded – undo
79 79
      *
80 80
      * @link https://paystack.com/docs/api/#page-add-products
81 81
      */
82
-    public function addProduct(string $page_id, array $payload = []): self
82
+    public function addProduct(string $page_id, array $payload = [ ]): self
83 83
     {
84
-        $this->post($this->url(self::ENDPOINT).'/'.$page_id.'/product', $payload);
84
+        $this->post($this->url(self::ENDPOINT) . '/' . $page_id . '/product', $payload);
85 85
 
86 86
         return $this;
87 87
     }
Please login to merge, or discard this patch.