11<?php
22/**
3- * Subreg - Usage Example
3+ * Subreg - Client Class
44 *
55 * @author Vítězslav Dvořák <info@vitexsoftware.cz>
6- * @copyright (C) 2018 Spoje.Net
6+ * @copyright (C) 2018-2019 Spoje.Net
77 */
88
99namespace Subreg ;
@@ -84,8 +84,8 @@ public function __construct($config)
8484 public function logBanner ($ additions = null )
8585 {
8686 return $ this ->addStatusMessage ('API ' .str_replace (':// ' ,
87- ':// ' .$ this ->config ['login ' ].'@ ' , $ this ->config ['uri ' ]).' php-subreg v ' .self ::$ libVersion .' EasePHP Framework v ' .\Ease \Atom::$ frameworkVersion .' ' .$ additions ,
88- 'debug ' );
87+ ':// ' .$ this ->config ['login ' ].'@ ' , $ this ->config ['uri ' ]).' php-subreg v ' .self ::$ libVersion .' EasePHP Framework v ' .\Ease \Atom::$ frameworkVersion .' ' .$ additions ,
88+ 'debug ' );
8989 }
9090
9191 /**
@@ -96,7 +96,7 @@ public function logBanner($additions = null)
9696 *
9797 * @return array
9898 */
99- public function call ($ command , $ params = [])
99+ public function call (string $ command , array $ params = [])
100100 {
101101 $ this ->lastError = null ;
102102 $ this ->lastStatus = null ;
@@ -243,44 +243,47 @@ public function domainsList()
243243 }
244244
245245 /**
246- * Get pricelist from your account
246+ * Get pricelist from your account
247247 *
248248 * @link https://subreg.cz/manual/?cmd=Pricelist Command: Pricelist
249249 *
250- * @return array
250+ * @return array pricelist details
251251 */
252252 public function pricelist ()
253253 {
254254 return $ this ->call ('Pricelist ' );
255255 }
256-
256+
257257 /**
258- * Get specified pricelist from your account
258+ * Renew a existing domain from your account
259259 *
260- * @link https://subreg.cz/manual/?cmd=Get_Pricelist Command: Get_Pricelist
260+ * @link https://subreg.cz/manual/?cmd=Renew_Domain Command: Renew_Domain
261261 *
262- * @param string requested pricelist name
262+ * @param string $domain name
263+ * @param int $years
263264 *
264- * @return array
265+ * @return string|array OK or Result array
265266 */
266- public function getPricelist ( $ pricelist )
267+ public function renewDomain ( string $ domain , int $ years = 1 )
267268 {
268- return $ this ->call ('Get_Pricelist ' , ['pricelist ' =>$ pricelist ]);
269+ return $ this ->call ('Make_Order ' ,
270+ ['order ' => ['domain ' => $ domain , 'params ' => ['period ' => $ years ],
271+ 'type ' => 'Renew_Domain ' ]]);
269272 }
270-
273+
271274 /**
275+ * Set autorenew policy for your domain.
272276 *
273- * @link https://subreg.cz/manual/?cmd=Renew_Domain Command: Renew_Domain
277+ * @link https://subreg.cz/manual/?cmd=Set_Autorenew Command: Set_Autorenew
274278 *
275- * @param string $domain name
276- * @param int $years
279+ * @param string $domain
280+ * @param string $renew only EXPIRE, AUTORENEW or RENEWONCE
277281 *
278- * @return type
282+ * @return string|array OK or Result array
279283 */
280- public function renewDomain (string $ domain , int $ years = 1 )
284+ public function setAutorenew (string $ domain , string $ renew )
281285 {
282- return $ this ->call ('Make_Order ' , ['order ' => ['domain ' => $ domain , 'params ' => ['period ' => $ years ], 'type ' => 'Renew_Domain ' ]] );
286+ return $ this ->call ('Set_Autorenew ' ,
287+ ['domain ' => $ domain , 'autorenew ' => $ renew ]);
283288 }
284-
285-
286289}
0 commit comments