/**
  * @return Client
  * @throws InvalidConfigurationException
  */
 protected function getClient()
 {
     if (!$this->client) {
         $this->client = $this->gitHubClientFactory->createClient();
         $token = $this->configProvider->getApiToken();
         if (empty($token)) {
             throw new InvalidConfigurationException('GitHub API token isn\'t set.');
         }
         $this->client->authenticate($token, null, Client::AUTH_URL_TOKEN);
     }
     return $this->client;
 }
 /**
  * {@inheritdoc}
  */
 public function init(Transport $transportEntity)
 {
     $token = $transportEntity->getSettingsBag()->get('token');
     if (empty($token)) {
         throw new InvalidConfigurationException('GitHub API token isn\'t set.');
     }
     $this->gitHubOrganization = $transportEntity->getSettingsBag()->get('organization');
     if (empty($this->gitHubOrganization)) {
         throw new InvalidConfigurationException('GitHub organization isn\'t set.');
     }
     $this->gitHubRepo = $transportEntity->getSettingsBag()->get('repo');
     if (empty($this->gitHubRepo)) {
         throw new InvalidConfigurationException('GitHub repo isn\'t set.');
     }
     $this->client = $this->gitHubClientFactory->createClient();
     $this->client->authenticate($token, null, Client::AUTH_URL_TOKEN);
     return $this->client;
 }
 public function testCreateClient()
 {
     $factory = new GitHubClientFactory();
     $actual = $factory->createClient();
     $this->assertInstanceOf('Github\\Client', $actual);
 }