@@ -33,7 +33,7 @@ |
||
33 | 33 | admin: $registrantContact, |
34 | 34 | tech: $registrantContact, |
35 | 35 | billing: $registrantContact, |
36 | - nameserverList: ['ns1.example.com', 'ns2.example.com'], |
|
36 | + nameserverList: [ 'ns1.example.com', 'ns2.example.com' ], |
|
37 | 37 | privacy: 'true', |
38 | 38 | currency: 'USD', |
39 | 39 | registerPremium: false, |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | $result = $this->request( |
64 | 64 | 'GET', |
65 | 65 | "domains/{$domainName}", |
66 | - [], |
|
66 | + [ ], |
|
67 | 67 | DomainListResult::class |
68 | 68 | ); |
69 | 69 | |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | $result = $this->request( |
110 | 110 | 'GET', |
111 | 111 | "contacts/{$contactId}", |
112 | - [], |
|
112 | + [ ], |
|
113 | 113 | Contact::class |
114 | 114 | ); |
115 | 115 | |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | $result = $this->request( |
130 | 130 | 'GET', |
131 | 131 | "contacts", |
132 | - [], |
|
132 | + [ ], |
|
133 | 133 | ContactListResult::class |
134 | 134 | ); |
135 | 135 | |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | $result = $this->request( |
154 | 154 | 'GET', |
155 | 155 | "domains", |
156 | - [], |
|
156 | + [ ], |
|
157 | 157 | DomainListResult::class |
158 | 158 | ); |
159 | 159 | |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | $result = $this->request( |
177 | 177 | 'PUT', |
178 | 178 | "domains/{$domain}/renew_option", |
179 | - ['renew_option' => $renewOption], |
|
179 | + [ 'renew_option' => $renewOption ], |
|
180 | 180 | RenewOptionResult::class |
181 | 181 | ); |
182 | 182 | |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | $result = $this->request( |
199 | 199 | 'GET', |
200 | 200 | "domains/bulk_search", |
201 | - ['domain_name_list' => implode(',', array_map('trim', $domains))], |
|
201 | + [ 'domain_name_list' => implode(',', array_map('trim', $domains)) ], |
|
202 | 202 | BulkSearchResult::class |
203 | 203 | ); |
204 | 204 | |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | $result = $this->request( |
269 | 269 | 'GET', |
270 | 270 | 'accounts/info', |
271 | - [], |
|
271 | + [ ], |
|
272 | 272 | AccountInfoResult::class |
273 | 273 | ); |
274 | 274 | |
@@ -302,15 +302,15 @@ discard block |
||
302 | 302 | ]; |
303 | 303 | |
304 | 304 | // For GET requests, use params as query parameters |
305 | - if ($method === 'GET' && ! empty($params)) { |
|
306 | - $options['query'] = $params; |
|
305 | + if ($method === 'GET' && !empty($params)) { |
|
306 | + $options[ 'query' ] = $params; |
|
307 | 307 | $payloadJson = ''; |
308 | 308 | } else { |
309 | 309 | $payloadJson = json_encode($params, JSON_UNESCAPED_SLASHES); |
310 | 310 | if ($payloadJson === false) { |
311 | 311 | throw new InvalidArgumentException('Failed to encode request body as JSON'); |
312 | 312 | } |
313 | - $options['body'] = $payloadJson; |
|
313 | + $options[ 'body' ] = $payloadJson; |
|
314 | 314 | } |
315 | 315 | |
316 | 316 | $stringToSign = implode("\n", [ |
@@ -320,12 +320,12 @@ discard block |
||
320 | 320 | $payloadJson, |
321 | 321 | ]); |
322 | 322 | $signature = hash_hmac('sha256', $stringToSign, $this->apiSecret); |
323 | - $options['headers']['X-Signature'] = $signature; |
|
323 | + $options[ 'headers' ][ 'X-Signature' ] = $signature; |
|
324 | 324 | |
325 | 325 | try { |
326 | 326 | $response = $this->http->request($method, $path, $options); |
327 | 327 | } catch (RequestException $e) { |
328 | - if ($e->getHandlerContext()['errno'] ?? null) { |
|
328 | + if ($e->getHandlerContext()[ 'errno' ] ?? null) { |
|
329 | 329 | throw new NetworkException('Network error communicating with Dynadot API', 0, $e); |
330 | 330 | } |
331 | 331 | |
@@ -340,19 +340,19 @@ discard block |
||
340 | 340 | $data = json_decode($response->getBody()->getContents(), true); |
341 | 341 | |
342 | 342 | // check the status code in the json response and throw an exception if it's not 200 |
343 | - if ($data['code'] >= 400) { |
|
343 | + if ($data[ 'code' ] >= 400) { |
|
344 | 344 | // Create a request object for the exception |
345 | - $request = new Request($method, $path, $options['headers'], $options['body'] ?? null); |
|
345 | + $request = new Request($method, $path, $options[ 'headers' ], $options[ 'body' ] ?? null); |
|
346 | 346 | |
347 | 347 | throw ApiException::fromResponse($request, $response); |
348 | 348 | } |
349 | 349 | |
350 | - if (! is_a($dtoClass, DtoInterface::class, true)) { |
|
350 | + if (!is_a($dtoClass, DtoInterface::class, true)) { |
|
351 | 351 | throw new InvalidArgumentException("$dtoClass must implement DtoInterface"); |
352 | 352 | } |
353 | 353 | |
354 | 354 | /** @var DtoInterface $dto */ |
355 | - $dto = $dtoClass::fromArray($data['data'] ?? []); |
|
355 | + $dto = $dtoClass::fromArray($data[ 'data' ] ?? [ ]); |
|
356 | 356 | |
357 | 357 | return $dto; |
358 | 358 | } |
@@ -16,8 +16,8 @@ |
||
16 | 16 | public static function fromArray(array $data): self |
17 | 17 | { |
18 | 18 | return new self( |
19 | - $data['currency'] ?? '', |
|
20 | - $data['amount'] ?? '' |
|
19 | + $data[ 'currency' ] ?? '', |
|
20 | + $data[ 'amount' ] ?? '' |
|
21 | 21 | ); |
22 | 22 | } |
23 | 23 |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | string $totalSpending = '', |
42 | 42 | string $priceLevel = '', |
43 | 43 | string $accountBalance = '', |
44 | - array $balanceList = [] |
|
44 | + array $balanceList = [ ] |
|
45 | 45 | ) { |
46 | 46 | $this->username = $username; |
47 | 47 | $this->forumName = $forumName; |
@@ -63,29 +63,29 @@ discard block |
||
63 | 63 | |
64 | 64 | public static function fromArray(array $data): self |
65 | 65 | { |
66 | - $balanceList = []; |
|
67 | - if (isset($data['balance_list']) && is_array($data['balance_list'])) { |
|
68 | - foreach ($data['balance_list'] as $item) { |
|
69 | - $balanceList[] = BalanceListItem::fromArray($item); |
|
66 | + $balanceList = [ ]; |
|
67 | + if (isset($data[ 'balance_list' ]) && is_array($data[ 'balance_list' ])) { |
|
68 | + foreach ($data[ 'balance_list' ] as $item) { |
|
69 | + $balanceList[ ] = BalanceListItem::fromArray($item); |
|
70 | 70 | } |
71 | 71 | } |
72 | 72 | |
73 | 73 | return new self( |
74 | - $data['username'] ?? '', |
|
75 | - $data['forum_name'] ?? '', |
|
76 | - $data['avatar_url'] ?? '', |
|
77 | - isset($data['account_contact']) ? AccountContact::fromArray($data['account_contact']) : new AccountContact(), |
|
78 | - $data['customer_since'] ?? 0, |
|
79 | - $data['account_lock'] ?? '', |
|
80 | - $data['custom_time_zone'] ?? '', |
|
81 | - $data['default_registrant_contact_id'] ?? 0, |
|
82 | - $data['default_admin_contact_id'] ?? 0, |
|
83 | - $data['default_technical_contact_id'] ?? 0, |
|
84 | - $data['default_billing_contact_id'] ?? 0, |
|
85 | - isset($data['default_name_server_settings']) ? DefaultNameServerSettings::fromArray($data['default_name_server_settings']) : new DefaultNameServerSettings(), |
|
86 | - $data['total_spending'] ?? '', |
|
87 | - $data['price_level'] ?? '', |
|
88 | - $data['account_balance'] ?? '', |
|
74 | + $data[ 'username' ] ?? '', |
|
75 | + $data[ 'forum_name' ] ?? '', |
|
76 | + $data[ 'avatar_url' ] ?? '', |
|
77 | + isset($data[ 'account_contact' ]) ? AccountContact::fromArray($data[ 'account_contact' ]) : new AccountContact(), |
|
78 | + $data[ 'customer_since' ] ?? 0, |
|
79 | + $data[ 'account_lock' ] ?? '', |
|
80 | + $data[ 'custom_time_zone' ] ?? '', |
|
81 | + $data[ 'default_registrant_contact_id' ] ?? 0, |
|
82 | + $data[ 'default_admin_contact_id' ] ?? 0, |
|
83 | + $data[ 'default_technical_contact_id' ] ?? 0, |
|
84 | + $data[ 'default_billing_contact_id' ] ?? 0, |
|
85 | + isset($data[ 'default_name_server_settings' ]) ? DefaultNameServerSettings::fromArray($data[ 'default_name_server_settings' ]) : new DefaultNameServerSettings(), |
|
86 | + $data[ 'total_spending' ] ?? '', |
|
87 | + $data[ 'price_level' ] ?? '', |
|
88 | + $data[ 'account_balance' ] ?? '', |
|
89 | 89 | $balanceList |
90 | 90 | ); |
91 | 91 | } |
@@ -33,13 +33,13 @@ |
||
33 | 33 | public static function fromArray(array $data): self |
34 | 34 | { |
35 | 35 | return new self( |
36 | - $data['type'] ?? '', |
|
37 | - $data['with_ads'] ?? '', |
|
38 | - $data['forward_to'] ?? '', |
|
39 | - $data['forward_type'] ?? '', |
|
40 | - $data['website_title'] ?? '', |
|
41 | - $data['ttl'] ?? '', |
|
42 | - isset($data['email_forwarding']) ? EmailForwarding::fromArray($data['email_forwarding']) : new EmailForwarding() |
|
36 | + $data[ 'type' ] ?? '', |
|
37 | + $data[ 'with_ads' ] ?? '', |
|
38 | + $data[ 'forward_to' ] ?? '', |
|
39 | + $data[ 'forward_type' ] ?? '', |
|
40 | + $data[ 'website_title' ] ?? '', |
|
41 | + $data[ 'ttl' ] ?? '', |
|
42 | + isset($data[ 'email_forwarding' ]) ? EmailForwarding::fromArray($data[ 'email_forwarding' ]) : new EmailForwarding() |
|
43 | 43 | ); |
44 | 44 | } |
45 | 45 |
@@ -14,7 +14,7 @@ |
||
14 | 14 | public static function fromArray(array $data): self |
15 | 15 | { |
16 | 16 | return new self( |
17 | - isset($data['account_info']) ? AccountInfo::fromArray($data['account_info']) : new AccountInfo() |
|
17 | + isset($data[ 'account_info' ]) ? AccountInfo::fromArray($data[ 'account_info' ]) : new AccountInfo() |
|
18 | 18 | ); |
19 | 19 | } |
20 | 20 |
@@ -14,7 +14,7 @@ |
||
14 | 14 | public static function fromArray(array $data): self |
15 | 15 | { |
16 | 16 | return new self( |
17 | - $data['type'] ?? '' |
|
17 | + $data[ 'type' ] ?? '' |
|
18 | 18 | ); |
19 | 19 | } |
20 | 20 |
@@ -51,19 +51,19 @@ |
||
51 | 51 | public static function fromArray(array $data): self |
52 | 52 | { |
53 | 53 | return new self( |
54 | - $data['organization'] ?? '', |
|
55 | - $data['name'] ?? '', |
|
56 | - $data['email'] ?? '', |
|
57 | - $data['phone_number'] ?? '', |
|
58 | - $data['phone_cc'] ?? '', |
|
59 | - $data['fax_number'] ?? '', |
|
60 | - $data['fax_cc'] ?? '', |
|
61 | - $data['address1'] ?? '', |
|
62 | - $data['address2'] ?? '', |
|
63 | - $data['city'] ?? '', |
|
64 | - $data['state'] ?? '', |
|
65 | - $data['zip'] ?? '', |
|
66 | - $data['country'] ?? '' |
|
54 | + $data[ 'organization' ] ?? '', |
|
55 | + $data[ 'name' ] ?? '', |
|
56 | + $data[ 'email' ] ?? '', |
|
57 | + $data[ 'phone_number' ] ?? '', |
|
58 | + $data[ 'phone_cc' ] ?? '', |
|
59 | + $data[ 'fax_number' ] ?? '', |
|
60 | + $data[ 'fax_cc' ] ?? '', |
|
61 | + $data[ 'address1' ] ?? '', |
|
62 | + $data[ 'address2' ] ?? '', |
|
63 | + $data[ 'city' ] ?? '', |
|
64 | + $data[ 'state' ] ?? '', |
|
65 | + $data[ 'zip' ] ?? '', |
|
66 | + $data[ 'country' ] ?? '' |
|
67 | 67 | ); |
68 | 68 | } |
69 | 69 |