public __construct ( array $config = [] ) : void | ||
$config | array | Available configuration options are: - `'persistent'` _boolean_ - `'scheme'` _string_ - `'host'` _string_ - `'port'` _integer_ - `'timeout'` _integer_ - `'auth'` _boolean_ - `'username'` _string_ - `'password'` _string_ - `'encoding'` _string_ - `'socket'` _string_ |
return | void |
public function __construct(array $config = array())
{
$defaults = array('persistent' => false, 'scheme' => 'http', 'host' => 'localhost', 'port' => null, 'timeout' => 30, 'auth' => null, 'username' => null, 'password' => null, 'encoding' => 'UTF-8', 'socket' => 'Context');
parent::__construct($config + $defaults);
}
/** * Constructor. Expects a connection configured like the following: * * Connections::add('freshbooks', array( * 'host' => 'yourusername.freshbooks.com', * 'token' => 'tokengoeshere', * ); * * @param array $config * @author John Anderson */ public function __construct(array $config = array()) { $this->_connection = Connections::get('freshbooks', array('config' => true)); $defaults = array('scheme' => 'https', 'host' => trim($this->_connection['host']), 'socket' => 'Curl', 'username' => trim($this->_connection['token']), 'password' => 'X', 'encoding' => 'UTF-8'); parent::__construct($config + $defaults); }