Skip to content

Commit

Permalink
Change variable name
Browse files Browse the repository at this point in the history
  • Loading branch information
burhandodhy committed Mar 7, 2024
1 parent 9ed55af commit f022ba5
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions includes/api/class-bc-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,10 @@ public function get_last_error() {
*
* @param string $url the url to call
* @param array $args the arguments to pass to the API call
* @param bool $cache_response whether or not to cache the response irrespective of the response code
* @param bool $cache_fail_response whether or not to cache the api response even if it's failed
* @return array|false|mixed|WP_Error
*/
private function cached_get( $url, $args, $cache_response = false ) {
private function cached_get( $url, $args, $cache_fail_response = false ) {

global $bc_accounts;

Expand All @@ -126,14 +126,14 @@ private function cached_get( $url, $args, $cache_response = false ) {
* Filter whether to cache the api response.
*
* @since 2.8.5
* @hook brightcove_cache_api_response
* @param {bool} $cache_response Whether to cache the response.
* @hook brightcove_cache_api_fail_response
* @param {bool} $cache_fail_response Whether to cache the response.
* @param {string} $url The URL of the request.
* @param {array} $args The arguments of the request.
*/
$cache_response = apply_filters( 'brightcove_cache_api_response', $cache_response, $url, $args );
$cache_fail_response = apply_filters( 'brightcove_cache_api_fail_response', $cache_fail_response, $url, $args );

if ( in_array( wp_remote_retrieve_response_code( $request ), $successful_response_codes, true ) || $cache_response ) {
if ( in_array( wp_remote_retrieve_response_code( $request ), $successful_response_codes, true ) || $cache_fail_response ) {
BC_Utility::set_cache_item( $transient_key, '', $request, $cache_time_in_seconds );
}
}
Expand All @@ -151,11 +151,11 @@ private function cached_get( $url, $args, $cache_response = false ) {
* @param string $method the http method to use
* @param array $data array of further data to send to the server
* @param boolean $force_new_token whether or not to force obtaining a new oAuth token
* @param boolean $cache_response whether or not to cache the response irrespective of the response code.
* @param boolean $cache_fail_response whether or not to cache the api response even if it's failed
*
* @return mixed the return data from the call of false if a failure occurred
*/
protected function send_request( $url, $method = 'GET', $data = array(), $force_new_token = false, $cache_response = false ) {
protected function send_request( $url, $method = 'GET', $data = array(), $force_new_token = false, $cache_fail_response = false ) {

$method = strtoupper( sanitize_text_field( $method ) );

Expand Down Expand Up @@ -219,7 +219,7 @@ protected function send_request( $url, $method = 'GET', $data = array(), $force_
switch ( $method ) {

case 'GET':
$request = $this->cached_get( $url, $args, $cache_response );
$request = $this->cached_get( $url, $args, $cache_fail_response );

break;

Expand Down

0 comments on commit f022ba5

Please sign in to comment.