public function __construct($key) { if (is_string($key) && !empty($key)) { $this->youtube_key = $key; } else { throw new \Exception('Google API key is Required, please visit https://console.developers.google.com/'); } }