1
1
<?php
2
2
/**
3
- * Subreg - Usage Example
3
+ * Subreg - Client Class
4
4
*
5
5
* @author Vítězslav Dvořák <[email protected] >
6
- * @copyright (C) 2018 Spoje.Net
6
+ * @copyright (C) 2018-2019 Spoje.Net
7
7
*/
8
8
9
9
namespace Subreg ;
@@ -84,8 +84,8 @@ public function __construct($config)
84
84
public function logBanner ($ additions = null )
85
85
{
86
86
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 ' );
89
89
}
90
90
91
91
/**
@@ -96,7 +96,7 @@ public function logBanner($additions = null)
96
96
*
97
97
* @return array
98
98
*/
99
- public function call ($ command , $ params = [])
99
+ public function call (string $ command , array $ params = [])
100
100
{
101
101
$ this ->lastError = null ;
102
102
$ this ->lastStatus = null ;
@@ -243,44 +243,47 @@ public function domainsList()
243
243
}
244
244
245
245
/**
246
- * Get pricelist from your account
246
+ * Get pricelist from your account
247
247
*
248
248
* @link https://subreg.cz/manual/?cmd=Pricelist Command: Pricelist
249
249
*
250
- * @return array
250
+ * @return array pricelist details
251
251
*/
252
252
public function pricelist ()
253
253
{
254
254
return $ this ->call ('Pricelist ' );
255
255
}
256
-
256
+
257
257
/**
258
- * Get specified pricelist from your account
258
+ * Renew a existing domain from your account
259
259
*
260
- * @link https://subreg.cz/manual/?cmd=Get_Pricelist Command: Get_Pricelist
260
+ * @link https://subreg.cz/manual/?cmd=Renew_Domain Command: Renew_Domain
261
261
*
262
- * @param string requested pricelist name
262
+ * @param string $domain name
263
+ * @param int $years
263
264
*
264
- * @return array
265
+ * @return string|array OK or Result array
265
266
*/
266
- public function getPricelist ( $ pricelist )
267
+ public function renewDomain ( string $ domain , int $ years = 1 )
267
268
{
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 ' ]]);
269
272
}
270
-
273
+
271
274
/**
275
+ * Set autorenew policy for your domain.
272
276
*
273
- * @link https://subreg.cz/manual/?cmd=Renew_Domain Command: Renew_Domain
277
+ * @link https://subreg.cz/manual/?cmd=Set_Autorenew Command: Set_Autorenew
274
278
*
275
- * @param string $domain name
276
- * @param int $years
279
+ * @param string $domain
280
+ * @param string $renew only EXPIRE, AUTORENEW or RENEWONCE
277
281
*
278
- * @return type
282
+ * @return string|array OK or Result array
279
283
*/
280
- public function renewDomain (string $ domain , int $ years = 1 )
284
+ public function setAutorenew (string $ domain , string $ renew )
281
285
{
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 ]);
283
288
}
284
-
285
-
286
289
}
0 commit comments