@@ -101,30 +101,31 @@ public function check($tlds = ['com'], $suggest = false, $stausIndex = 0)
101101 $ query = [
102102 'domain-name ' => $ this ->domain ,
103103 'suggest-alternative ' => json_encode ($ suggest ),
104- 'tlds ' => $ tlds
104+ 'tlds ' => $ tlds,
105105 ];
106106
107107 $ result = $ this ->request ('domains/available.json ' , $ query , 'GET ' , true );
108108
109109 try {
110- $ status = $ result ['response ' ]->{$ this ->domain ." . " .$ tlds [$ stausIndex ]}->status ;
110+ $ status = $ result ['response ' ]->{$ this ->domain .' . ' .$ tlds [$ stausIndex ]}->status ;
111111 } catch (\Exception $ e ) {
112112 $ status = 'unknown ' ;
113113 }
114-
114+
115115 $ result ['domain-status ' ] = $ status ;
116116
117117 return $ result ;
118118 }
119+
119120 /**
120- * Get only orderId
121+ * Get only orderId.
121122 *
122123 * @return array
123124 */
124125 public function orderId ()
125126 {
126127 return $ this ->request ('domains/orderid.json ' , [
127- 'domain-name ' => $ this ->domain
128+ 'domain-name ' => $ this ->domain ,
128129 ], 'GET ' );
129130 }
130131
@@ -146,12 +147,13 @@ public function disableTheftProtection()
146147
147148 /**
148149 * @param array $ns
150+ *
149151 * @return array
150152 */
151153 public function modifyNameServers (array $ ns )
152154 {
153155 $ query = [
154- 'ns ' => $ ns
156+ 'ns ' => $ ns,
155157 ];
156158
157159 return $ this ->requestWithOrderId ('domains/modify-ns.json ' , $ query , 'POST ' , true );
@@ -175,6 +177,7 @@ public function cancelTransfer()
175177
176178 /**
177179 * @param $query
180+ *
178181 * @return array
179182 */
180183 public function register ($ query )
@@ -186,6 +189,7 @@ public function register($query)
186189
187190 /**
188191 * @param $query
192+ *
189193 * @return array
190194 */
191195 public function transfer ($ query )
@@ -197,12 +201,13 @@ public function transfer($query)
197201
198202 /**
199203 * @param $authCode
204+ *
200205 * @return array
201206 */
202207 public function authCode ($ authCode )
203208 {
204209 $ query = $ this ->prepareAuthCode ($ authCode );
205- if (!$ authCode === $ query ['auth-code ' ]) {
210+ if (! $ authCode === $ query ['auth-code ' ]) {
206211 return $ query ;
207212 }
208213
@@ -211,12 +216,13 @@ public function authCode($authCode)
211216
212217 /**
213218 * @param $authCode
219+ *
214220 * @return array
215221 */
216222 public function modifyAuthCode ($ authCode )
217223 {
218224 $ query = $ this ->prepareAuthCode ($ authCode );
219- if (!$ authCode === $ query ['auth-code ' ]) {
225+ if (! $ authCode === $ query ['auth-code ' ]) {
220226 return $ query ;
221227 }
222228
@@ -240,28 +246,32 @@ public function validateTransferRequest()
240246 * @param $date
241247 * @param $invoiceOption
242248 * @param bool $purchasePrivacy
249+ *
243250 * @return array
244251 */
245- public function renew ($ years , $ date , $ invoiceOption , $ purchasePrivacy = false )
252+ public function renew ($ years , $ invoiceOption , $ purchasePrivacy = false )
246253 {
254+ $ end_time = $ this ->details ()['response ' ]->endtime ;
255+
247256 $ query = [
248257 'years ' => $ years ,
249- 'exp-date ' => strtotime ( $ date ) ,
258+ 'exp-date ' => $ end_time ,
250259 'invoice-option ' => $ invoiceOption ,
251- 'purchase-privacy ' => $ purchasePrivacy
260+ 'purchase-privacy ' => $ purchasePrivacy,
252261 ];
253262
254263 return $ this ->requestWithOrderId ('domains/renew.json ' , $ query , 'POST ' );
255264 }
256265
257266 /**
258267 * @param $customerId
268+ *
259269 * @return array
260270 */
261271 public function customerDefaultNameServers ($ customerId )
262272 {
263273 $ query = [
264- 'customer-id ' => $ customerId
274+ 'customer-id ' => $ customerId,
265275 ];
266276
267277 return $ this ->request ('domains/customer-default-ns.json ' , $ query , 'GET ' );
@@ -273,7 +283,7 @@ public function customerDefaultNameServers($customerId)
273283 public function isDomainPremium ()
274284 {
275285 $ query = [
276- 'domain-name ' => $ this ->domain
286+ 'domain-name ' => $ this ->domain ,
277287 ];
278288
279289 return $ this ->request ('domains/premium-check.json ' , $ query , 'GET ' );
@@ -282,13 +292,14 @@ public function isDomainPremium()
282292 /**
283293 * @param $cns
284294 * @param $ip
295+ *
285296 * @return array
286297 */
287298 public function addChildNs ($ cns , $ ip )
288299 {
289300 $ query = [
290301 'cns ' => $ cns ,
291- 'ip ' => $ ip
302+ 'ip ' => $ ip,
292303 ];
293304
294305 return $ this ->requestWithOrderId ('domains/add-cns.json ' , $ query , 'POST ' , true );
@@ -297,7 +308,7 @@ public function addChildNs($cns, $ip)
297308 public function requestWithOrderId ($ url , $ query , $ method , $ string = false )
298309 {
299310 $ resp = $ this ->orderId ();
300- if (!$ resp ['status ' ]) {
311+ if (! $ resp ['status ' ]) {
301312 return $ resp ;
302313 }
303314 $ orderId = $ resp ['response ' ];
@@ -310,7 +321,7 @@ public function modifyChildNsHostName($oldCns, $newCns)
310321 {
311322 $ query = [
312323 'old-cns ' => $ oldCns ,
313- 'new-cns ' => $ newCns
324+ 'new-cns ' => $ newCns,
314325 ];
315326
316327 return $ this ->requestWithOrderId ('domains/modify-cns-name.json ' , $ query , 'POST ' );
@@ -326,12 +337,13 @@ public function getListLockApplied()
326337
327338 /**
328339 * @param mixed $reason
340+ *
329341 * @return array
330342 */
331343 public function suspend ($ reason )
332344 {
333345 $ query = [
334- 'reason ' => $ reason
346+ 'reason ' => $ reason,
335347 ];
336348
337349 return $ this ->requestWithOrderId ('orders/suspend.json ' , $ query , 'POST ' );
@@ -349,7 +361,7 @@ public function suggestName($keyword, $tldOnly = false, $exactMatch = false)
349361 {
350362 $ query = [
351363 'keyword ' => $ keyword ,
352- 'exact-match ' => $ exactMatch
364+ 'exact-match ' => $ exactMatch,
353365 ];
354366
355367 if ($ tldOnly ) {
@@ -361,6 +373,7 @@ public function suggestName($keyword, $tldOnly = false, $exactMatch = false)
361373
362374 /**
363375 * @param $query
376+ *
364377 * @return array
365378 */
366379 public function modifyContact ($ query )
@@ -372,18 +385,19 @@ private function domain($option)
372385 {
373386 return $ this ->request ($ this ->url , [
374387 'domain-name ' => $ this ->domain ,
375- 'options ' => $ option
388+ 'options ' => $ option,
376389 ]);
377390 }
378391
379392 /**
380393 * @param $authCode
394+ *
381395 * @return array
382396 */
383397 private function prepareAuthCode ($ authCode )
384398 {
385399 $ resp = $ this ->orderId ();
386- if (!$ resp ['status ' ]) {
400+ if (! $ resp ['status ' ]) {
387401 return $ resp ;
388402 }
389403
0 commit comments