Пример #1
0
    /**
     * Constructor.
     *
     * All parameters may be passed as an array to the first argument of the 
     * constructor. If so, 
     *
     * @param  string|array $host   (Default: 127.0.0.1)
     * @param  null|int     $port   (Default: null)
     * @param  null|array   $config Auth-specific parameters
     */
    public function __construct($host = '127.0.0.1', $port = null, $config = null)
    {
        // Did we receive a configuration array?
        $origConfig = $config;
        if (is_array($host)) {
            // Merge config array with principal array, if provided
            if (is_array($config)) {
                $config = array_replace_recursive($host, $config);
            } else {
                $config = $host;
            }
        }

        if (is_array($config)) {
            if (isset($config['username'])) {
                $this->setUsername($config['username']);
            }
            if (isset($config['password'])) {
                $this->setPassword($config['password']);
            }
        }

        // Call parent with original arguments
        parent::__construct($host, $port, $origConfig);
    }
Пример #2
0
 /**
  * Constructor.
  *
  * All parameters may be passed as an array to the first argument of the
  * constructor. If so,
  *
  * @param  string|array $host   (Default: 127.0.0.1)
  * @param  null|int     $port   (Default: null)
  * @param  null|array   $config Auth-specific parameters
  */
 public function __construct($host = '127.0.0.1', $port = null, $config = null)
 {
     if (is_array($host)) {
         if (isset($host['xoauth2_request'])) {
             $this->_xoauth2_request = $host['xoauth2_request'];
         }
     }
     parent::__construct($host, $port, $config);
 }
Пример #3
0
 /**
  * Constructor.
  *
  * @param  string $host   (Default: 127.0.0.1)
  * @param  int    $port   (Default: null)
  * @param  array  $config Auth-specific parameters
  * @return void
  */
 public function __construct($host = '127.0.0.1', $port = null, $config = null)
 {
     if (is_array($config)) {
         if (isset($config['username'])) {
             $this->_username = $config['username'];
         }
         if (isset($config['password'])) {
             $this->_password = $config['password'];
         }
     }
     parent::__construct($host, $port, $config);
 }