Passed
Pull Request — master (#10)
by
unknown
02:50
created
src/Dynadot/Dto/DomainInfo.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -82,26 +82,26 @@
 block discarded – undo
82 82
     public static function fromArray(array $data): self
83 83
     {
84 84
         return new self(
85
-            $data['domainName'],
86
-            $data['expiration'],
87
-            $data['registration'],
88
-            $data['glueInfo'],
89
-            $data['registrant_contactId'],
90
-            $data['admin_contactId'],
91
-            $data['tech_contactId'],
92
-            $data['billing_contactId'],
93
-            $data['locked'],
94
-            $data['disabled'],
95
-            $data['udrpLocked'],
96
-            $data['registrant_unverified'] ?? false,
97
-            $data['hold'],
98
-            $data['privacy'],
99
-            $data['is_for_sale'],
100
-            $data['renew_option'],
101
-            $data['note'],
102
-            $data['folder_id'],
103
-            $data['folder_name'],
104
-            $data['status'],
85
+            $data[ 'domainName' ],
86
+            $data[ 'expiration' ],
87
+            $data[ 'registration' ],
88
+            $data[ 'glueInfo' ],
89
+            $data[ 'registrant_contactId' ],
90
+            $data[ 'admin_contactId' ],
91
+            $data[ 'tech_contactId' ],
92
+            $data[ 'billing_contactId' ],
93
+            $data[ 'locked' ],
94
+            $data[ 'disabled' ],
95
+            $data[ 'udrpLocked' ],
96
+            $data[ 'registrant_unverified' ] ?? false,
97
+            $data[ 'hold' ],
98
+            $data[ 'privacy' ],
99
+            $data[ 'is_for_sale' ],
100
+            $data[ 'renew_option' ],
101
+            $data[ 'note' ],
102
+            $data[ 'folder_id' ],
103
+            $data[ 'folder_name' ],
104
+            $data[ 'status' ],
105 105
         );
106 106
     }
107 107
 
Please login to merge, or discard this patch.
src/Dynadot/Dto/DomainInfoResult.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -23,11 +23,11 @@
 block discarded – undo
23 23
      */
24 24
     public static function fromArray(array $data): self
25 25
     {
26
-        $domains = [];
26
+        $domains = [ ];
27 27
         
28
-        if (isset($data['domainInfo']) && is_array($data['domainInfo'])) {
29
-            foreach ($data['domainInfo'] as $domainData) {
30
-                $domains[] = DomainInfo::fromArray($domainData);
28
+        if (isset($data[ 'domainInfo' ]) && is_array($data[ 'domainInfo' ])) {
29
+            foreach ($data[ 'domainInfo' ] as $domainData) {
30
+                $domains[ ] = DomainInfo::fromArray($domainData);
31 31
             }
32 32
         }
33 33
         
Please login to merge, or discard this patch.
examples/register-domain.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
         admin: $registrantContact,
39 39
         tech: $registrantContact,
40 40
         billing: $registrantContact,
41
-        nameserverList: ['ns1.example.com', 'ns2.example.com'],
41
+        nameserverList: [ 'ns1.example.com', 'ns2.example.com' ],
42 42
         privacy: 'true',
43 43
         currency: 'USD',
44 44
         registerPremium: false,
@@ -55,8 +55,8 @@  discard block
 block discarded – undo
55 55
     // Example: You can also use existing contacts by ID
56 56
     // First, get a list of existing contacts
57 57
     $contactList = $client->getContactList();
58
-    if (! empty($contactList->contacts)) {
59
-        $existingContact = $contactList->contacts[0];
58
+    if (!empty($contactList->contacts)) {
59
+        $existingContact = $contactList->contacts[ 0 ];
60 60
         echo "Using existing contact: " . $existingContact->name . " (ID: " . $existingContact->contactId . ")\n";
61 61
     }
62 62
 
Please login to merge, or discard this patch.
src/Dynadot/Client.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
         $result = $this->request(
62 62
             'GET',
63 63
             "domains/{$domainName}",
64
-            [],
64
+            [ ],
65 65
             DomainListResult::class
66 66
         );
67 67
 
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
         $result = $this->request(
106 106
             'GET',
107 107
             "contacts/{$contactId}",
108
-            [],
108
+            [ ],
109 109
             Contact::class
110 110
         );
111 111
 
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
         $result = $this->request(
126 126
             'GET',
127 127
             "contacts",
128
-            [],
128
+            [ ],
129 129
             ContactListResult::class
130 130
         );
131 131
 
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
         $result = $this->request(
150 150
             'GET',
151 151
             "domains",
152
-            [],
152
+            [ ],
153 153
             DomainListResult::class
154 154
         );
155 155
 
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
         $result = $this->request(
172 172
             'PUT',
173 173
             "domains/{$domain}/renew_option",
174
-            ['renew_option' => $renewOption],
174
+            [ 'renew_option' => $renewOption ],
175 175
             RenewOptionResult::class
176 176
         );
177 177
 
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
         $result = $this->request(
193 193
             'GET',
194 194
             "domains/bulk_search",
195
-            ['domain_name_list' => implode(',', array_map('trim', $domains))],
195
+            [ 'domain_name_list' => implode(',', array_map('trim', $domains)) ],
196 196
             BulkSearchResult::class
197 197
         );
198 198
 
@@ -272,15 +272,15 @@  discard block
 block discarded – undo
272 272
         ];
273 273
 
274 274
         // For GET requests, use params as query parameters
275
-        if ($method === 'GET' && ! empty($params)) {
276
-            $options['query'] = $params;
275
+        if ($method === 'GET' && !empty($params)) {
276
+            $options[ 'query' ] = $params;
277 277
             $payloadJson      = '';
278 278
         } else {
279 279
             $payloadJson = json_encode($params, JSON_UNESCAPED_SLASHES);
280 280
             if ($payloadJson === false) {
281 281
                 throw new InvalidArgumentException('Failed to encode request body as JSON');
282 282
             }
283
-            $options['body'] = $payloadJson;
283
+            $options[ 'body' ] = $payloadJson;
284 284
         }
285 285
 
286 286
         $stringToSign = implode("\n", [
@@ -290,12 +290,12 @@  discard block
 block discarded – undo
290 290
             $payloadJson,
291 291
         ]);
292 292
         $signature                         = hash_hmac('sha256', $stringToSign, $this->apiSecret);
293
-        $options['headers']['X-Signature'] = $signature;
293
+        $options[ 'headers' ][ 'X-Signature' ] = $signature;
294 294
 
295 295
         try {
296 296
             $response = $this->http->request($method, $path, $options);
297 297
         } catch (RequestException $e) {
298
-            if ($e->getHandlerContext()['errno'] ?? null) {
298
+            if ($e->getHandlerContext()[ 'errno' ] ?? null) {
299 299
                 throw new NetworkException('Network error communicating with Dynadot API', 0, $e);
300 300
             }
301 301
 
@@ -310,19 +310,19 @@  discard block
 block discarded – undo
310 310
         $data = json_decode($response->getBody()->getContents(), true);
311 311
 
312 312
         // check the status code in the json response and throw an exception if it's not 200
313
-        if ($data['code'] >= 400) {
313
+        if ($data[ 'code' ] >= 400) {
314 314
             // Create a request object for the exception
315
-            $request = new Request($method, $path, $options['headers'], $options['body'] ?? null);
315
+            $request = new Request($method, $path, $options[ 'headers' ], $options[ 'body' ] ?? null);
316 316
 
317 317
             throw ApiException::fromResponse($request, $response);
318 318
         }
319 319
 
320
-        if (! is_a($dtoClass, DtoInterface::class, true)) {
320
+        if (!is_a($dtoClass, DtoInterface::class, true)) {
321 321
             throw new InvalidArgumentException("$dtoClass must implement DtoInterface");
322 322
         }
323 323
 
324 324
         /** @var DtoInterface $dto */
325
-        $dto = $dtoClass::fromArray($data['data'] ?? []);
325
+        $dto = $dtoClass::fromArray($data[ 'data' ] ?? [ ]);
326 326
 
327 327
         return $dto;
328 328
     }
Please login to merge, or discard this patch.
src/Dynadot/Dto/PriceList.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -24,12 +24,12 @@
 block discarded – undo
24 24
     public static function fromArray(array $data): self
25 25
     {
26 26
         $dto               = new self();
27
-        $dto->currency     = $data['currency'] ?? '';
28
-        $dto->unit         = $data['unit'] ?? '';
29
-        $dto->registration = $data['registration'] ?? '';
30
-        $dto->renewal      = $data['renewal'] ?? '';
31
-        $dto->transfer     = $data['transfer'] ?? '';
32
-        $dto->restore      = $data['restore'] ?? '';
27
+        $dto->currency     = $data[ 'currency' ] ?? '';
28
+        $dto->unit         = $data[ 'unit' ] ?? '';
29
+        $dto->registration = $data[ 'registration' ] ?? '';
30
+        $dto->renewal      = $data[ 'renewal' ] ?? '';
31
+        $dto->transfer     = $data[ 'transfer' ] ?? '';
32
+        $dto->restore      = $data[ 'restore' ] ?? '';
33 33
 
34 34
         return $dto;
35 35
     }
Please login to merge, or discard this patch.