| @@ -32,7 +32,7 @@ discard block | ||
| 32 | 32 | admin: $registrantContact, | 
| 33 | 33 | tech: $registrantContact, | 
| 34 | 34 | billing: $registrantContact, | 
| 35 | - nameserverList: ['ns1.example.com', 'ns2.example.com'], | |
| 35 | + nameserverList: [ 'ns1.example.com', 'ns2.example.com' ], | |
| 36 | 36 | privacy: 'true', | 
| 37 | 37 | currency: 'USD', | 
| 38 | 38 | registerPremium: false, | 
| @@ -50,7 +50,7 @@ discard block | ||
| 50 | 50 | // First, get a list of existing contacts | 
| 51 | 51 | $contactList = $client->getContactList(); | 
| 52 | 52 |      if (!empty($contactList->contacts)) { | 
| 53 | - $existingContact = $contactList->contacts[0]; | |
| 53 | + $existingContact = $contactList->contacts[ 0 ]; | |
| 54 | 54 | echo "Using existing contact: " . $existingContact->name . " (ID: " . $existingContact->contactId . ")\n"; | 
| 55 | 55 | } | 
| 56 | 56 | |
| @@ -62,12 +62,12 @@ | ||
| 62 | 62 |      ): self { | 
| 63 | 63 | $body = (string) $res->getBody(); | 
| 64 | 64 | $data = json_decode($body, true); | 
| 65 | - $code = $data['code'] ?? $res->getStatusCode(); | |
| 65 | + $code = $data[ 'code' ] ?? $res->getStatusCode(); | |
| 66 | 66 | |
| 67 | 67 |          if (json_last_error() !== JSON_ERROR_NONE) { | 
| 68 | 68 | $msg = 'Invalid JSON in error response: ' . json_last_error_msg(); | 
| 69 | 69 |          } else { | 
| 70 | - $msg = $data['error']['description'] ?? $data['message'] ?? $res->getReasonPhrase(); | |
| 70 | + $msg = $data[ 'error' ][ 'description' ] ?? $data[ 'message' ] ?? $res->getReasonPhrase(); | |
| 71 | 71 | } | 
| 72 | 72 | |
| 73 | 73 |          switch ($code) { | 
| @@ -61,7 +61,7 @@ discard block | ||
| 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 | ||
| 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 | ||
| 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 | ||
| 149 | 149 | $result = $this->request( | 
| 150 | 150 | 'GET', | 
| 151 | 151 | "domains", | 
| 152 | - [], | |
| 152 | + [ ], | |
| 153 | 153 | DomainListResult::class | 
| 154 | 154 | ); | 
| 155 | 155 | return $result; | 
| @@ -170,7 +170,7 @@ discard block | ||
| 170 | 170 | $result = $this->request( | 
| 171 | 171 | 'PUT', | 
| 172 | 172 |              "domains/{$domain}/renew_option", | 
| 173 | - ['renew_option' => $renewOption], | |
| 173 | + [ 'renew_option' => $renewOption ], | |
| 174 | 174 | RenewOptionResult::class | 
| 175 | 175 | ); | 
| 176 | 176 | |
| @@ -191,7 +191,7 @@ discard block | ||
| 191 | 191 | $result = $this->request( | 
| 192 | 192 | 'GET', | 
| 193 | 193 | "domains/bulk_search", | 
| 194 | -            ['domain_name_list' => implode(',', array_map('trim', $domains))], | |
| 194 | +            [ 'domain_name_list' => implode(',', array_map('trim', $domains)) ], | |
| 195 | 195 | BulkSearchResult::class | 
| 196 | 196 | ); | 
| 197 | 197 | |
| @@ -272,14 +272,14 @@ discard block | ||
| 272 | 272 | |
| 273 | 273 | // For GET requests, use params as query parameters | 
| 274 | 274 |          if ($method === 'GET' && !empty($params)) { | 
| 275 | - $options['query'] = $params; | |
| 275 | + $options[ 'query' ] = $params; | |
| 276 | 276 | $payloadJson = ''; | 
| 277 | 277 |          } else { | 
| 278 | 278 | $payloadJson = json_encode($params, JSON_UNESCAPED_SLASHES); | 
| 279 | 279 |              if ($payloadJson === false) { | 
| 280 | 280 |                  throw new InvalidArgumentException('Failed to encode request body as JSON'); | 
| 281 | 281 | } | 
| 282 | - $options['body'] = $payloadJson; | |
| 282 | + $options[ 'body' ] = $payloadJson; | |
| 283 | 283 | } | 
| 284 | 284 | |
| 285 | 285 |          $stringToSign = implode("\n", [ | 
| @@ -289,12 +289,12 @@ discard block | ||
| 289 | 289 | $payloadJson, | 
| 290 | 290 | ]); | 
| 291 | 291 |          $signature = hash_hmac('sha256', $stringToSign, $this->apiSecret); | 
| 292 | - $options['headers']['X-Signature'] = $signature; | |
| 292 | + $options[ 'headers' ][ 'X-Signature' ] = $signature; | |
| 293 | 293 | |
| 294 | 294 |          try { | 
| 295 | 295 | $response = $this->http->request($method, $path, $options); | 
| 296 | 296 |          } catch (RequestException $e) { | 
| 297 | -            if ($e->getHandlerContext()['errno'] ?? null) { | |
| 297 | +            if ($e->getHandlerContext()[ 'errno' ] ?? null) { | |
| 298 | 298 |                  throw new NetworkException('Network error communicating with Dynadot API', 0, $e); | 
| 299 | 299 | } | 
| 300 | 300 | |
| @@ -309,9 +309,9 @@ discard block | ||
| 309 | 309 | $data = json_decode($response->getBody()->getContents(), true); | 
| 310 | 310 | |
| 311 | 311 | // check the status code in the json response and throw an exception if it's not 200 | 
| 312 | -        if ($data['code'] >= 400) { | |
| 312 | +        if ($data[ 'code' ] >= 400) { | |
| 313 | 313 | // Create a request object for the exception | 
| 314 | - $request = new Request($method, $path, $options['headers'], $options['body'] ?? null); | |
| 314 | + $request = new Request($method, $path, $options[ 'headers' ], $options[ 'body' ] ?? null); | |
| 315 | 315 | throw ApiException::fromResponse($request, $response); | 
| 316 | 316 | } | 
| 317 | 317 | |
| @@ -320,7 +320,7 @@ discard block | ||
| 320 | 320 | } | 
| 321 | 321 | |
| 322 | 322 | /** @var DtoInterface $dto */ | 
| 323 | - $dto = $dtoClass::fromArray($data['data'] ?? []); | |
| 323 | + $dto = $dtoClass::fromArray($data[ 'data' ] ?? [ ]); | |
| 324 | 324 | |
| 325 | 325 | return $dto; | 
| 326 | 326 | } | 
| @@ -24,8 +24,8 @@ | ||
| 24 | 24 | public static function fromArray(array $data): self | 
| 25 | 25 |      { | 
| 26 | 26 | return new self( | 
| 27 | - $data['code'] ?? null, | |
| 28 | - $data['message'] ?? null, | |
| 27 | + $data[ 'code' ] ?? null, | |
| 28 | + $data[ 'message' ] ?? null, | |
| 29 | 29 | ); | 
| 30 | 30 | } | 
| 31 | 31 | |
| @@ -82,26 +82,26 @@ | ||
| 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['registrantUnverified'], | |
| 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[ 'registrantUnverified' ], | |
| 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 | |
| @@ -33,17 +33,17 @@ | ||
| 33 | 33 | */ | 
| 34 | 34 | public static function fromArray(array $data): self | 
| 35 | 35 |      { | 
| 36 | - $priceList = []; | |
| 37 | -        if (isset($data['price_list']) && is_array($data['price_list'])) { | |
| 38 | -            foreach ($data['price_list'] as $priceData) { | |
| 39 | - $priceList[] = PriceList::fromArray($priceData); | |
| 36 | + $priceList = [ ]; | |
| 37 | +        if (isset($data[ 'price_list' ]) && is_array($data[ 'price_list' ])) { | |
| 38 | +            foreach ($data[ 'price_list' ] as $priceData) { | |
| 39 | + $priceList[ ] = PriceList::fromArray($priceData); | |
| 40 | 40 | } | 
| 41 | 41 | } | 
| 42 | 42 | |
| 43 | 43 | return new self( | 
| 44 | - $data['domain_name'] ?? '', | |
| 45 | - $data['available'] ?? '', | |
| 46 | - $data['premium'] ?? '', | |
| 44 | + $data[ 'domain_name' ] ?? '', | |
| 45 | + $data[ 'available' ] ?? '', | |
| 46 | + $data[ 'premium' ] ?? '', | |
| 47 | 47 | $priceList, | 
| 48 | 48 | ); | 
| 49 | 49 | } | 
| @@ -23,11 +23,11 @@ | ||
| 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 | |
| @@ -24,8 +24,8 @@ | ||
| 24 | 24 | public static function fromArray(array $data): self | 
| 25 | 25 |      { | 
| 26 | 26 | return new self( | 
| 27 | - $data['domain_name'] ?? '', | |
| 28 | - $data['available'] ?? '', | |
| 27 | + $data[ 'domain_name' ] ?? '', | |
| 28 | + $data[ 'available' ] ?? '', | |
| 29 | 29 | ); | 
| 30 | 30 | } | 
| 31 | 31 | |
| @@ -24,8 +24,8 @@ | ||
| 24 | 24 | public static function fromArray(array $data): self | 
| 25 | 25 |      { | 
| 26 | 26 | return new self( | 
| 27 | - $data['code'] ?? 0, | |
| 28 | - $data['message'] ?? '', | |
| 27 | + $data[ 'code' ] ?? 0, | |
| 28 | + $data[ 'message' ] ?? '', | |
| 29 | 29 | ); | 
| 30 | 30 | } | 
| 31 | 31 | |