Skip to content

Commit

Permalink
refactor some code and docs
Browse files Browse the repository at this point in the history
  • Loading branch information
madcoda committed Sep 4, 2015
1 parent f72792d commit c6ef4ad
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/Madcoda/Youtube.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,10 @@ class Youtube


/**
* The API Key
* @var string
*/
protected $youtube_key; //pass in by constructor
protected $youtube_key;


/**
Expand Down Expand Up @@ -81,24 +82,31 @@ public function __construct($params = array())
if (!array_key_exists('key', $params) || empty($params['key']) ) {
throw new \InvalidArgumentException('Google API key is required, please visit http://code.google.com/apis/console');
}
$this->youtube_key = $params['key'];
$this->setApiKey($params['key']);

if (array_key_exists('referer', $params)) {
$this->referer = $params['referer'];
$this->setReferer($params['referer']);
}
}
}


/**
* Update the API key, useful if you want to switch
* multiple keys to avoid quota problem
* @param $apiKey
*/
public function setApiKey($apiKey)
{
$this->youtube_key = $apiKey;
}



public function setReferer($referer){
$this->referer = $referer;
}

/**
* @param $vId
* @return \StdClass
Expand Down

0 comments on commit c6ef4ad

Please sign in to comment.