/** * @param int|array[] $type An EndpointTypes constant or an array of mappings * @param string|array $endpoint Call with null to remove a mapping * @param array $parameters KVPs of additional parameters * * @throws \InvalidArgumentException * @return BaseProviderConfig */ public function mapEndpoint($type, $endpoint = null, $parameters = null) { // Allow for an array of endpoints to be passed in... if (is_array($type) && null === $endpoint) { foreach ($type as $_endpointType => $_endpoint) { $this->mapEndpoint($_endpointType, $_endpoint); } return $this; } $type = $this->_getEndpointType($type); if (!EndpointTypes::contains($type)) { throw new \InvalidArgumentException('The endpoint type "' . $type . '" is not valid.'); } if (null === $endpoint) { Option::remove($this->_endpointMap, $type); return $this; } if (is_string($endpoint)) { $endpoint = array('endpoint' => $endpoint, 'parameters' => $parameters ?: array()); } $this->_endpointMap[$type] = $endpoint; return $this; }
/** * Removes a mapping * * @param string|int $key * * @return $this */ public function unmap($key) { Option::remove($this->_map, $this->_hashKey($key)); return $this; }
/** * Base constructor * * @param array|object $settings An array of key/value pairs that will be placed into storage */ public function __construct($settings = array()) { // Since $_id is read-only we remove it Option::remove($settings, 'id'); // Now, set the rest if (!empty($settings)) { foreach ($settings as $_key => $_value) { Option::set($this, $_key, $_value); } } // Wake-up the events $this->__wakeup(); }
/** * Google Plus does not allow the state parameter when making access tokens requests, so it is removed from the * payload. * * @param string $grantType * @param array $payload * * @return array|false * @throws \InvalidArgumentException */ public function requestAccessToken($grantType = GrantTypes::AUTHORIZATION_CODE, array $payload = array()) { Option::remove($payload, 'state'); return parent::requestAccessToken($grantType, $payload); }
/** * Serialize */ public static function __sleep() { // Save options out to session... if (static::$_awake && isset($_SESSION)) { // Freeze the options and stow, but not the autoloader $_SESSION[CoreSettings::SESSION_KEY] = static::$_options; // Remove the autoloader from the SESSION. Option::remove($_SESSION[CoreSettings::SESSION_KEY], CoreSettings::AUTO_LOADER); // Remove the autoloader at this key if there is one (some apps used the wrong key) Option::remove($_SESSION[CoreSettings::SESSION_KEY], 'app.autoloader'); // Now store our options $_SESSION[CoreSettings::SESSION_KEY] = Storage::freeze($_SESSION[CoreSettings::SESSION_KEY]); } }