Throttling check.

Checks the passed LinkedIn response to see if we have hit a throttling
limit:

http://developer.linkedin.com/docs/DOC-1112

@param arr $response
The LinkedIn response.

@return bool
TRUE/FALSE depending on content of response.
487849
public static function isThrottled($response) {
	  $return_data = FALSE;
    
    // check the variable
	  if(!empty($response) && is_string($response)) {
	    // we have an array and have a properly formatted LinkedIn response
	       
      // store the response in a temp variable
      $temp_response = self::xmlToArray($response);
  	  if($temp_response !== FALSE) {
    	  // check to see if we have an error
    	  if(array_key_exists('error', $temp_response) && ($temp_response['error']['children']['status']['content'] == 403) && preg_match('/throttle/i', $temp_response['error']['children']['message']['content'])) {
    	    // we have an error, it is 403 and we have hit a throttle limit
  	      $return_data = TRUE;
    	  }
  	  }
  	}
  	return $return_data;
	}
1226089
protected function extractTookFromResponse(array $response)
    {
        if (is_null($response['body'])) {
            return null;
        }
        $content = stream_get_contents($response['body']);
        rewind($response['body']);

        if (preg_match('/\"took\":(\d+)/', $content, $matches)) {
            return (int) $matches[1];
        }

        return null;
    }
62456
protected function isValidResponse($response)
    {
        if (empty($this->acceptable)) {
            return true;
        }

        if ($this->acceptableIsClosure()) {
            return call_user_func($this->acceptable, $response);
        }

        return $this->isAcceptableResponse($response);
    }
991029
protected function hasBasicAuthPrompt(HTTPResponse $response = null)
    {
        if (!$response) {
            return false;
        }
        return ($response->getStatusCode() === 401 && $response->getHeader('WWW-Authenticate'));
    }
214594
public static function getNextResult(&$response)
    {
        //====================================================================//
        // Extract Next Task From Buffer
        $task = self::getNextTask($response);
        //====================================================================//
        // Analyze SOAP Results
        if (!$task || !isset($task->data)) {
            return false;
        }
        //====================================================================//
        // Return Task Data
        return $task->data;
    }
14455
protected function IsSuccessResponse($response = '')
    {
        $bPaymentOk = false;
        $oGlobal = TGlobal::instance();
        if (empty($response)) {
            $aResult = $this->GetNeedeResponsePostParameterForSecurityCheck();
            $aResult['ret_status'] = $oGlobal->GetUserData('ret_status');
        } else {
            $aResult = $this->GetResultFormResponse($response);
        }

        if (count($aResult) > 0 && array_key_exists('ret_status', $aResult) && 'SUCCESS' == $aResult['ret_status']) {
            $bPaymentOk = true;
        }
        if ($bPaymentOk) {
            $bPaymentOk = $this->IsSecurityCheckOk($aResult['trxuser_id'], $aResult['trx_amount'], $aResult['trx_currency'], $aResult['ret_authcode'], $aResult['ret_trx_number'], $aResult['ret_param_checksum']);
        }

        return $bPaymentOk;
    }
342553
public function parse_meta_response( $response ) {
		if ( $this->validate_response( $response ) ) {
			return $response;
		}
		$arr      = [];
		$response = [ $response ];

		array_filter(
			$response,
			function ( $e ) use ( &$arr ) {
				$arr['private']      = $e->is_private;
				$arr['last_updated'] = $e->updated_on;
				$arr['watchers']     = 0;
				$arr['forks']        = 0;
				$arr['open_issues']  = 0;
			}
		);

		return $arr;
	}
73299
protected function shouldProcessPageSpeed($request, $response)
    {
        $patterns = config('laravel-page-speed.skip');
        $patterns = (is_null($patterns))?[]: $patterns;

        if (! $this->isEnable()) {
            return false;
        }

        if ($response instanceof BinaryFileResponse) {
            return false;
        }

        if ($response instanceof StreamedResponse) {
           return false;
        }

        foreach ($patterns as $pattern) {
            if ($request->is($pattern)) {
                return false;
            }
        }

        return true;
    }
677511
public static function isJsonError($response)
    {

        if(is_wp_error($response)) {
            return true; 
        }

        if ($decoded = json_decode($response)) {
            $response = (array) $decoded;
        }

        if (isset($response['error'])) {
            return true;
        }
        
        return false;
    }
837845
protected function handleBulkResponse(string $response): ?string
	{
		if($response === '$-1')
		{
			return null;
		}

		$length = (int) substr($response, 1);

		return substr($this->connection->read($length + static::CRLF_LENGTH), 0, - static::CRLF_LENGTH);
	}
786460
private function _isValidResponse($response)
    {
        if (is_null($response)) {
            return self::ERROR_EMPTY;
        }

        if (!isset($response->result) or ($response->result != 'error')) {
            return true;
        }

        return $response->message;
    }
1133405
public function checkResponse($response) {
    if (!is_array($response)) {
      return FALSE;
    }

    $responseParams = array();
    foreach ($this->responseFields as $k => $mandatory) {
      if (isset($response[$k])) {
        $responseParams[$k] = $response[$k];
      }
      elseif (!isset($response[$k]) && $mandatory) {
        throw new \Exception('expected response field ' . $k . ' is missing');
      }
    }

    return $responseParams;
  }
82623
protected function isValid($response)
    {
        if (is_null($response)) {
            return true;
        }
        if (app('request') instanceof Request) {
            return $response->getStatusCode() !== 401;
        }
        return true;
    }
431574
protected function isSuccess($response, $code)
    {
        if ($code !== 200 && $code !== 201) {
            return false;
        }

        if (isset($response['error'])) {
            return false;
        }

        if (!empty(Arr::get($response, 'payments'))) {
            return in_array($this->getPaymentStatus($response), $this->successPaymentStatuses);
        }

        return true;
    }
509997
public function next($response): ?callable
    {
        if ($this->isEmpty()) {
            return null;
        }

        if (!is_null($response)) {
            return null;
        }

        return $this->pop();
    }
148646
public static function isCommitSuccess($response)
    {
        //====================================================================//
        // Analyze NuSOAP results
        if (!$response || !isset($response->result) || (true != $response->result)) {
            return false;
        }

        return true;
    }
917732
private function shouldSendDataOnNextPage(ResponseInterface $response): bool
    {
        $status_code = $response->getStatusCode();

        return $status_code === self::STATUS_FOUND || $status_code === self::STATUS_MOVED_PERMANENTLY;
    }