protected function get_service() {
        global $CFG;

        if (!$apikey = get_config('block_tag_youtube', 'apikey')) {
            return false;
        }

        // Wrapped in an if in case we call different get_videos_* multiple times.
        if (!isset($this->service)) {
            require_once($CFG->libdir . '/google/lib.php');
            $client = get_google_client();
            $client->setDeveloperKey($apikey);
            $client->setScopes(array(Google_Service_YouTube::YOUTUBE_READONLY));
            $this->service = new Google_Service_YouTube($client);
        }

        return $this->service;
    }
protected function get_service() {
        global $CFG;

        if (!$apikey = get_config('block_tag_youtube', 'apikey')) {
            return false;
        }

        // Wrapped in an if in case we call different get_videos_* multiple times.
        if (!isset($this->service)) {
            require_once($CFG->libdir . '/google/lib.php');
            $client = get_google_client();
            $client->setDeveloperKey($apikey);
            $client->setScopes(array(Google_Service_YouTube::YOUTUBE_READONLY));
            $this->service = new Google_Service_YouTube($client);
        }

        return $this->service;
    }
protected function get_service ( ) { global $ CFG ; if ( ! $ apikey = get_config ( 'block_tag_youtube' , 'apikey' ) ) { return false ; } // Wrapped in an if in case we call different get_videos_* multiple times. if ( ! isset ( $ this -> service ) ) { require_once ( $ CFG -> libdir . '/google/lib.php' ) ; $ client = get_google_client ( ) ; $ client -> setDeveloperKey ( $ apikey ) ; $ client -> setScopes ( array ( Google_Service_YouTube :: YOUTUBE_READONLY ) ) ; $ this -> service = new Google_Service_YouTube ( $ client ) ; } return $ this -> service ; }
Gets the youtube service object.

@return Google_Service_YouTube
Gets the youtube service object .