コード例 #1
0
ファイル: Client.php プロジェクト: trivago/tas-sdk-php
 public function __construct(Config $config)
 {
     $this->apiKey = $config->getApiKey();
     $this->baseUrl = $config->getBaseUrl();
     $this->acceptLanguage = $config->getAcceptLanguage();
     $this->httpHandler = $config->getHttpHandler();
     $this->trackingIdHandler = new TrackingIdHandler($config->getTrackingIdCallback(), $config->getStoreTrackingIdCallback());
 }
コード例 #2
0
ファイル: ConfigTest.php プロジェクト: trivago/tas-sdk-php
 public function test_default_config()
 {
     $getTrackingIdCallback = new TrackingIdCallable();
     $storeTrackingIdCallback = new TrackingIdCallable();
     $configArray = $this->getValidConfigArray();
     $configArray[Config::GET_TRACKING_ID_CALLBACK] = $getTrackingIdCallback;
     $configArray[Config::STORE_TRACKING_ID_CALLBACK] = $storeTrackingIdCallback;
     $config = new Config($configArray);
     $this->assertSame($config->getAcceptLanguage(), 'en-GB');
     $this->assertSame($getTrackingIdCallback, $config->getTrackingIdCallback());
     $this->assertSame($storeTrackingIdCallback, $config->getStoreTrackingIdCallback());
     $this->assertSame('1234', $config->getApiKey());
     $this->assertSame('https://api.trivago.com/webservice/affiliate', $config->getBaseUrl());
     $this->assertInstanceOf(HttpHandler::class, $config->getHttpHandler());
 }