getClient() public method

public getClient ( string $id ) : yii\authclient\ClientInterface
$id string service id.
return yii\authclient\ClientInterface auth client instance.
コード例 #1
0
 /**
  * Gets first client by default.
  */
 public function getClient($id = null)
 {
     if ($id === null) {
         list($id, $dummy) = each($this->getClients());
     }
     return parent::getClient($id);
 }
コード例 #2
0
 /**
  * @depends testGetProviderById
  */
 public function testCreateProvider()
 {
     $collection = new Collection();
     $clientId = 'testClientId';
     $clientClassName = TestClient::className();
     $clients = [$clientId => ['class' => $clientClassName]];
     $collection->setClients($clients);
     $provider = $collection->getClient($clientId);
     $this->assertTrue(is_object($provider), 'Unable to create client by config!');
     $this->assertTrue(is_a($provider, $clientClassName), 'Client has wrong class name!');
 }