__construct() public method

Constructor.
public __construct ( array $config = [] ) : void
$config array
return void
示例#1
0
 /**
  * Constructor.
  *
  * @param array $config Configuration options.
  */
 public function __construct(array $config = array())
 {
     $defaults = array('scheme' => 'https', 'host' => '{:login}.freshbooks.com', 'port' => null, 'login' => null, 'password' => '', 'auth' => 'Basic', 'version' => '1.1', 'path' => '/api/2.1');
     $config += $defaults;
     $config['host'] = String::insert($config['host'], $config);
     $config['login'] = $config['password'];
     $config['password'] = '******';
     parent::__construct($config);
 }
示例#2
0
 /**
  * Constructor.
  *
  * @param array $config Configuration options.
  */
 public function __construct(array $config = array())
 {
     $defaults = array('adapter' => 'GitHub', 'token' => null, 'scheme' => 'https', 'version' => '1.1', 'host' => 'api.github.com', 'port' => 443, 'path' => '', 'headers' => array('Accept' => 'application/vnd.github.beta+json'));
     if (!empty($config['token'])) {
         $defaults['headers'] += array("Authorization" => "token {$config['token']}");
     }
     if (!empty($config['login']) && !empty($config['password'])) {
         $defaults['auth'] = "Basic";
     }
     parent::__construct($config + $defaults);
 }
示例#3
0
 /**
  * Constructor.
  *
  * @param array $config Configuration options.
  */
 public function __construct(array $config = array())
 {
     if (!empty($config['token'])) {
         $login = $config['login'] . '/token';
         $password = $config['token'];
     } else {
         $login = $config['login'];
         $password = $config['password'];
     }
     $defaults = array('adapter' => 'GitHub', 'token' => null, 'scheme' => 'https', 'auth' => 'Basic', 'version' => '1.1', 'port' => 443, 'basePath' => '/api/v2/json');
     $config['host'] = 'github.com';
     $config['login'] = $login;
     $config['password'] = $password;
     parent::__construct($config + $defaults);
 }
 /**
  * Constructor
  *
  * @param array $config
  */
 public function __construct(array $config = array())
 {
     $defaults = array('host' => 'api.clickatell.com', 'scheme' => 'https', 'port' => '443', 'method' => 'get', 'service' => 'rest', 'format' => 'xml', 'method_prefix' => 'clickatell', 'encoding' => 'UTF-8', 'socket' => 'Context');
     $config += $defaults;
     if (!isset($config['api_id'])) {
         throw new ConfigException('Clickatell api_id is not configured.');
     }
     if (!isset($config['api_username'])) {
         throw new ConfigException('Clickatell api_username is not configured.');
     }
     if (!isset($config['api_password'])) {
         throw new ConfigException('Clickatell api_password is not configured.');
     }
     parent::__construct($config);
 }
示例#5
0
文件: CouchDb.php 项目: niel/lithium
	/**
	 * Constructor.
	 * @param array $config
	 */
	public function __construct(array $config = array()) {
		$defaults = array('port' => 5984, 'version' => 1);
		parent::__construct($config + $defaults);
	}
示例#6
0
 /**
  * Add configuration to the WordPress data source
  *
  * @param array $config The optional config
  */
 public function __construct(array $config = array())
 {
     $config += array('provider' => 'google', 'providerAdapter' => 'curl', 'providerOptions' => array());
     parent::__construct($config);
 }
示例#7
0
 public function __construct(array $config = array())
 {
     $defaults = array('scheme' => 'http', 'host' => 'otter.topsy.com', 'port' => 80, 'version' => '1.1');
     $config += $defaults;
     parent::__construct($config + $defaults);
 }
示例#8
0
 /**
  * Constructor
  *
  * @param array $config
  * @return void
  */
 public function __construct($config = array())
 {
     $defaults = array('port' => 5984);
     $config = (array) $config + $defaults;
     parent::__construct($config);
 }
示例#9
0
 public function __construct(array $config = array())
 {
     $defaults = array('host' => 'localhost', 'port' => 8080);
     parent::__construct($config + $defaults);
     $this->_queryBuilder = $this->_instance('query');
 }