/** @internal */ public function __construct($apiKey, $apiSecret, $options = array()) { // unpack optional arguments (merging with default values) into named variables $defaults = array('apiUrl' => 'https://api.opentok.com', 'client' => null); $options = array_merge($defaults, array_intersect_key($options, $defaults)); list($apiUrl, $client) = array_values($options); // validate arguments Validators::validateApiKey($apiKey); Validators::validateApiSecret($apiSecret); Validators::validateApiUrl($apiUrl); Validators::validateClient($client); $this->client = isset($client) ? $client : new Client(); $this->client->configure($apiKey, $apiSecret, $apiUrl); $this->apiKey = $apiKey; $this->apiSecret = $apiSecret; }