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