request), 'client'); $property->setAccessible(true); $property->setValue($client->request, $httpClient); return $client; } /** * Return Client object * * @param string $url (default: null) * @param array $defaultParameters (default: array()) * * @return Client */ public static function getClient($url = null, $defaultParameters = []) { $configUrl = getenv('RETAILCRM_URL') ?: $_SERVER['RETAILCRM_URL']; $configKey = getenv('RETAILCRM_KEY') ?: $_SERVER['RETAILCRM_KEY']; $configVersion = getenv('RETAILCRM_VERSION') ?: $_SERVER['RETAILCRM_VERSION']; return new Client( $url ?: $configUrl . '/api/' . $configVersion, [ 'apiKey' => array_key_exists('apiKey', $defaultParameters) ? $defaultParameters['apiKey'] : $configKey ] ); } }