Moinax\TvDb\Client::__construct PHP Method

__construct() public method

public __construct ( string $baseUrl, string $apiKey )
$baseUrl string Domain name of the api without trailing slash
$apiKey string Api key provided by http://thetvdb.com
    public function __construct($baseUrl, $apiKey)
    {
        $this->baseUrl = $baseUrl;
        $this->apiKey = $apiKey;
        $this->httpClient = new CurlClient();
    }

Usage Example

Example #1
0
 /**
  * @param      $baseUrl
  * @param      $apiKey
  * @param null $cachePath
  * @param null $cacheTtl
  */
 public function __construct($baseUrl, $apiKey, $cachePath = null, $cacheTtl = null)
 {
     parent::__construct($baseUrl, $apiKey);
     if ($cachePath != null && is_string($cachePath)) {
         // Set default cache TTL to one week.
         $cacheTtl != null && is_int($cacheTtl) ? $cacheTtl : 86400 * 7;
         // Create cache client and assign it to TvDb-client
         $cache = new FilesystemCache($cachePath);
         $httpClient = new CacheClient($cache, $cacheTtl);
         $this->setHttpClient($httpClient);
     }
 }