예제 #1
0
 /**
  * Constructor
  * 
  * Prepare the adapter for use by Service.
  * 
  * If $RFT is not passed the const Cpanel_Service_Adapter_WHMapi::DRFT will be
  * used when invoking {@link setAdapterResponseFormatType()} at 
  * instantiation
  * 
  * HTTP port is set to '2087' by default.  {@link setPort()}
  * 
  * NOTE: this constructor as support for the legacy PHP XML-API client class
  * 
  * @param string $host     Host address for query call
  * @param string $user     User to authenticate query call
  * @param string $password Password to authenticate query call
  * @param string $RFT      Response format type
  * 
  * @return Cpanel_Service_Adapter_WHMapi
  */
 public function __construct($host = null, $user = null, $password = null, $RFT = null)
 {
     parent::__construct();
     if ($host) {
         $this->host = $host;
     }
     if ($user) {
         $this->user = $user;
     }
     if ($password) {
         $this->setPassword($password);
     }
     $this->setPort('2087');
     $RFT = $RFT ? $RFT : self::DRFT;
     $this->setAdapterResponseFormatType($RFT);
     return $this;
 }
예제 #2
0
 /**
  * Constructor
  *
  * Prepare the adapter for use by Service.
  *
  * If $RFT is not passed the const Cpanel_Service_Adapter_WHMapi::DRFT will be
  * used when invoking {@link setAdapterResponseFormatType()} at
  * instantiation
  *
  * HTTP port is set to '2087' by default.  {@link setPort()}
  *
  * NOTE: this constructor as support for the legacy PHP XML-API client class
  *
  * @param string $host     Host address for query call
  * @param string $user     User to authenticate query call
  * @param string $password Password to authenticate query call
  * @param string $RFT      Response format type
  *
  * @throws Exception in case of no valid stread wrapper is found
  * @return Cpanel_Service_Adapter_WHMapi
  */
 public function __construct($host = null, $user = null, $password = null, $RFT = null)
 {
     parent::__construct();
     if ($host) {
         $this->host = $host;
     }
     if ($user) {
         $this->user = $user;
     }
     if ($password) {
         $this->setPassword($password);
     }
     // @codeCoverageIgnoreStart
     $registeredStreams = stream_get_wrappers();
     if (in_array('https', $registeredStreams)) {
         $port = 2087;
     } elseif (in_array('http', $registeredStreams)) {
         $port = 2086;
     } else {
         throw new Exception('No valid protocol stream wrapper registered');
     }
     // @codeCoverageIgnoreEnd
     $this->setPort($port);
     $RFT = $RFT ? $RFT : self::DRFT;
     $this->setAdapterResponseFormatType($RFT);
     return $this;
 }