@@ -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['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 | |
@@ -38,7 +38,7 @@ discard block |
||
| 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 |
||
| 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 | |
@@ -24,12 +24,12 @@ |
||
| 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 | } |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | $result = $this->request( |
| 63 | 63 | 'GET', |
| 64 | 64 | "domains/{$domainName}", |
| 65 | - [], |
|
| 65 | + [ ], |
|
| 66 | 66 | DomainListResult::class |
| 67 | 67 | ); |
| 68 | 68 | |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | $result = $this->request( |
| 109 | 109 | 'GET', |
| 110 | 110 | "contacts/{$contactId}", |
| 111 | - [], |
|
| 111 | + [ ], |
|
| 112 | 112 | Contact::class |
| 113 | 113 | ); |
| 114 | 114 | |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | $result = $this->request( |
| 129 | 129 | 'GET', |
| 130 | 130 | "contacts", |
| 131 | - [], |
|
| 131 | + [ ], |
|
| 132 | 132 | ContactListResult::class |
| 133 | 133 | ); |
| 134 | 134 | |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | $result = $this->request( |
| 153 | 153 | 'GET', |
| 154 | 154 | "domains", |
| 155 | - [], |
|
| 155 | + [ ], |
|
| 156 | 156 | DomainListResult::class |
| 157 | 157 | ); |
| 158 | 158 | |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | $result = $this->request( |
| 176 | 176 | 'PUT', |
| 177 | 177 | "domains/{$domain}/renew_option", |
| 178 | - ['renew_option' => $renewOption], |
|
| 178 | + [ 'renew_option' => $renewOption ], |
|
| 179 | 179 | RenewOptionResult::class |
| 180 | 180 | ); |
| 181 | 181 | |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | $result = $this->request( |
| 198 | 198 | 'GET', |
| 199 | 199 | "domains/bulk_search", |
| 200 | - ['domain_name_list' => implode(',', array_map('trim', $domains))], |
|
| 200 | + [ 'domain_name_list' => implode(',', array_map('trim', $domains)) ], |
|
| 201 | 201 | BulkSearchResult::class |
| 202 | 202 | ); |
| 203 | 203 | |
@@ -282,29 +282,29 @@ discard block |
||
| 282 | 282 | |
| 283 | 283 | // For GET requests, use params as query parameters |
| 284 | 284 | if ($method === 'GET' && !empty($params)) { |
| 285 | - $options['query'] = $params; |
|
| 285 | + $options[ 'query' ] = $params; |
|
| 286 | 286 | $payloadJson = ''; |
| 287 | 287 | } else { |
| 288 | 288 | $payloadJson = json_encode($params, JSON_UNESCAPED_SLASHES); |
| 289 | 289 | if ($payloadJson === false) { |
| 290 | 290 | throw new InvalidArgumentException('Failed to encode request body as JSON'); |
| 291 | 291 | } |
| 292 | - $options['body'] = $payloadJson; |
|
| 292 | + $options[ 'body' ] = $payloadJson; |
|
| 293 | 293 | } |
| 294 | 294 | |
| 295 | - $stringToSign = implode("\n", [ |
|
| 295 | + $stringToSign = implode("\n", [ |
|
| 296 | 296 | $this->apiKey, |
| 297 | 297 | '/' . trim($path, '/'), |
| 298 | 298 | $requestId, |
| 299 | 299 | $payloadJson, |
| 300 | 300 | ]); |
| 301 | 301 | $signature = hash_hmac('sha256', $stringToSign, $this->apiSecret); |
| 302 | - $options['headers']['X-Signature'] = $signature; |
|
| 302 | + $options[ 'headers' ][ 'X-Signature' ] = $signature; |
|
| 303 | 303 | |
| 304 | 304 | try { |
| 305 | 305 | $response = $this->http->request($method, $path, $options); |
| 306 | 306 | } catch (RequestException $e) { |
| 307 | - if ($e->getHandlerContext()['errno'] ?? null) { |
|
| 307 | + if ($e->getHandlerContext()[ 'errno' ] ?? null) { |
|
| 308 | 308 | throw new NetworkException('Network error communicating with Dynadot API', 0, $e); |
| 309 | 309 | } |
| 310 | 310 | |
@@ -319,9 +319,9 @@ discard block |
||
| 319 | 319 | $data = json_decode($response->getBody()->getContents(), true); |
| 320 | 320 | |
| 321 | 321 | // check the status code in the json response and throw an exception if it's not 200 |
| 322 | - if ($data['code'] >= 400) { |
|
| 322 | + if ($data[ 'code' ] >= 400) { |
|
| 323 | 323 | // Create a request object for the exception |
| 324 | - $request = new Request($method, $path, $options['headers'], $options['body'] ?? null); |
|
| 324 | + $request = new Request($method, $path, $options[ 'headers' ], $options[ 'body' ] ?? null); |
|
| 325 | 325 | |
| 326 | 326 | throw ApiException::fromResponse($request, $response); |
| 327 | 327 | } |
@@ -331,7 +331,7 @@ discard block |
||
| 331 | 331 | } |
| 332 | 332 | |
| 333 | 333 | /** @var DtoInterface $dto */ |
| 334 | - $dto = $dtoClass::fromArray($data['data'] ?? []); |
|
| 334 | + $dto = $dtoClass::fromArray($data[ 'data' ] ?? [ ]); |
|
| 335 | 335 | |
| 336 | 336 | return $dto; |
| 337 | 337 | } |