Constructor. Initializes a new Service instance with the default HTTP request settings
and transport- and format-handling classes.
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_ |
리턴 | void |
/** * 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); }
/** * Constructor * * @param array $config * - host: the oauth domain * - oauth_consumer_secret: secret from oauth service provider * - oauth_consumer_key: key from oauth service provider * - authorize: path to authorize url * - request_token: path to request token url * - access_token: path to access token url */ public function __construct($config = array()) { $defaults = array('scheme' => 'http', 'host' => 'localhost', 'proxy' => false, 'port' => 80, 'authorize' => '/oauth/authorize', 'authenticate' => '/oauth/authenticate', 'request' => '/oauth/request_token', 'access' => '/oauth/access_token', 'oauth_consumer_key' => 'key', 'oauth_consumer_secret' => 'secret'); $config += $defaults; parent::__construct($config); }
/** * Constructor * * @param array $config * - host: the oauth domain * - oauth_consumer_secret: secret from oauth service provider * - oauth_consumer_key: key from oauth service provider * - authorize: path to authorize url * - request_token: path to request token url * - access_token: path to access token url */ public function __construct($config = array()) { $defaults = array('scheme' => 'http', 'scope' => 'email', 'host' => 'localhost', 'access' => '/oauth/access_token', 'secondary_host' => '', 'proxy' => false, 'port' => 80, 'authorize' => '/dialog/oauth', 'authenticate' => '/dialog/oauth', 'request' => '/oauth/request_token', 'logout' => '/oauth/request_token', 'client_id' => 'key', 'client_secret' => 'secret', 'restponse_type' => 'code', 'state' => '', 'grant_type' => '', 'next' => '', 'logout' => '/logout.php'); $config += $defaults; parent::__construct($config); }