当前位置: 首页>>代码示例>>PHP>>正文


PHP ApiClient::getConfig方法代码示例

本文整理汇总了PHP中Swagger\Client\ApiClient::getConfig方法的典型用法代码示例。如果您正苦于以下问题:PHP ApiClient::getConfig方法的具体用法?PHP ApiClient::getConfig怎么用?PHP ApiClient::getConfig使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Swagger\Client\ApiClient的用法示例。


在下文中一共展示了ApiClient::getConfig方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: ApiClient

 /**
  * Constructor
  * @param \Swagger\Client\ApiClient|null $apiClient The api client to use
  */
 function __construct($apiClient = null)
 {
     if ($apiClient == null) {
         $apiClient = new ApiClient();
         $apiClient->getConfig()->setHost('http://petstore.swagger.io/v2');
     }
     $this->apiClient = $apiClient;
 }
开发者ID:niebes,项目名称:swagger-codegen,代码行数:12,代码来源:StoreApi.php

示例2: __construct

 /**
  * Constructor
  *
  * @param \Swagger\Client\ApiClient|null $apiClient The api client to use
  */
 public function __construct(\Swagger\Client\ApiClient $apiClient = null)
 {
     if ($apiClient == null) {
         $apiClient = new ApiClient();
         $apiClient->getConfig()->setHost('http://example.com/rest/default');
     }
     $this->apiClient = $apiClient;
 }
开发者ID:springimport,项目名称:magento2-swagger-api,代码行数:13,代码来源:QuoteGuestCartItemRepositoryVApi.php

示例3: testApiClient

 public function testApiClient()
 {
     // test selectHeaderAccept
     $api_client = new ApiClient();
     $this->assertSame('application/json', $api_client->selectHeaderAccept(array('application/xml', 'application/json')));
     $this->assertSame(null, $api_client->selectHeaderAccept(array()));
     $this->assertSame('application/yaml,application/xml', $api_client->selectHeaderAccept(array('application/yaml', 'application/xml')));
     // test selectHeaderContentType
     $this->assertSame('application/json', $api_client->selectHeaderContentType(array('application/xml', 'application/json')));
     $this->assertSame('application/json', $api_client->selectHeaderContentType(array()));
     $this->assertSame('application/yaml,application/xml', $api_client->selectHeaderContentType(array('application/yaml', 'application/xml')));
     // test addDefaultHeader and getDefaultHeader
     $api_client->getConfig()->addDefaultHeader('test1', 'value1');
     $api_client->getConfig()->addDefaultHeader('test2', 200);
     $defaultHeader = $api_client->getConfig()->getDefaultHeaders();
     $this->assertSame('value1', $defaultHeader['test1']);
     $this->assertSame(200, $defaultHeader['test2']);
     // test deleteDefaultHeader
     $api_client->getConfig()->deleteDefaultHeader('test2');
     $defaultHeader = $api_client->getConfig()->getDefaultHeaders();
     $this->assertFalse(isset($defaultHeader['test2']));
     $pet_api2 = new Api\PetApi();
     $config3 = new Configuration();
     $apiClient3 = new ApiClient($config3);
     $apiClient3->getConfig()->setUserAgent('api client 3');
     $config4 = new Configuration();
     $apiClient4 = new ApiClient($config4);
     $apiClient4->getConfig()->setUserAgent('api client 4');
     $pet_api3 = new Api\PetApi($apiClient3);
     // 2 different api clients are not the same
     $this->assertNotEquals($apiClient3, $apiClient4);
     // customied pet api not using the old pet api's api client
     $this->assertNotEquals($pet_api2->getApiClient(), $pet_api3->getApiClient());
     // test access token
     $api_client->getConfig()->setAccessToken("testing_only");
     $this->assertSame('testing_only', $api_client->getConfig()->getAccessToken());
 }
开发者ID:mateuszmackowiak,项目名称:swagger-codegen,代码行数:37,代码来源:ApiClientTest.php


注:本文中的Swagger\Client\ApiClient::getConfig方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。