original_string: public function delete($video_id)
  	{
  		$accessToken = $this->client->getAccessToken();
  
  		if (is_null($accessToken))
  		{
  			throw new \Exception('You need an access token to delete.');
  		}
  
  		// Attempt to refresh the access token if it's expired and save the new one in the database
  		if ($this->client->isAccessTokenExpired())
  		{
  			$accessToken = json_decode($accessToken);
  			$refreshToken = $accessToken->refresh_token;
  			$this->client->refreshToken($refreshToken);
  			$newAccessToken = $this->client->getAccessToken();
  			$this->saveAccessTokenToDB($newAccessToken);
  		}
  
  		$result = $this->youtube->videos->delete($video_id);
  
  		if (!$result)
  		{
  			throw new \Exception("Couldn't delete the video from the youtube account.");
  		}
  
  		return $result->getId();
  
  	}
code: public function delete($video_id)
  	{
  		$accessToken = $this->client->getAccessToken();
  
  		if (is_null($accessToken))
  		{
  			throw new \Exception('You need an access token to delete.');
  		}
  
  		// Attempt to refresh the access token if it's expired and save the new one in the database
  		if ($this->client->isAccessTokenExpired())
  		{
  			$accessToken = json_decode($accessToken);
  			$refreshToken = $accessToken->refresh_token;
  			$this->client->refreshToken($refreshToken);
  			$newAccessToken = $this->client->getAccessToken();
  			$this->saveAccessTokenToDB($newAccessToken);
  		}
  
  		$result = $this->youtube->videos->delete($video_id);
  
  		if (!$result)
  		{
  			throw new \Exception("Couldn't delete the video from the youtube account.");
  		}
  
  		return $result->getId();
  
  	}
code_tokens: public function delete ( $ video_id ) { $ accessToken = $ this -> client -> getAccessToken ( ) ; if ( is_null ( $ accessToken ) ) { throw new \ Exception ( 'You need an access token to delete.' ) ; } // Attempt to refresh the access token if it's expired and save the new one in the database if ( $ this -> client -> isAccessTokenExpired ( ) ) { $ accessToken = json_decode ( $ accessToken ) ; $ refreshToken = $ accessToken -> refresh_token ; $ this -> client -> refreshToken ( $ refreshToken ) ; $ newAccessToken = $ this -> client -> getAccessToken ( ) ; $ this -> saveAccessTokenToDB ( $ newAccessToken ) ; } $ result = $ this -> youtube -> videos -> delete ( $ video_id ) ; if ( ! $ result ) { throw new \ Exception ( "Couldn't delete the video from the youtube account." ) ; } return $ result -> getId ( ) ; }
docstring: Deletes a video from the account specified by the Access Token
  Attempts to automatically refresh the token if it's expired.
  
  @param $id of the video to delete
  @return true if the video was deleted and false if it was not
  @throws \Exception
docstring_tokens: Deletes a video from the account specified by the Access Token Attempts to automatically refresh the token if it s expired .