You are here

public static function ApiClient::validateReturn in Rocket.Chat 8

Same name and namespace in other branches
  1. 8.2 modules/rocket_chat_api/src/RocketChat/ApiClient.php \Drupal\rocket_chat_api\RocketChat\ApiClient::validateReturn()

Checks for several different type of error states.

Parameters

array $result: Result to check.

Return value

bool does the Return seem ok?

2 calls to ApiClient::validateReturn()
ApiClient::login in modules/rocket_chat_api/src/RocketChat/ApiClient.php
Do a Login on the Rocket Chat REST API.
ApiClient::logout in modules/rocket_chat_api/src/RocketChat/ApiClient.php
Logout a session.

File

modules/rocket_chat_api/src/RocketChat/ApiClient.php, line 262

Class

ApiClient
Class ApiClient.

Namespace

Drupal\rocket_chat_api\RocketChat

Code

public static function validateReturn(array &$result) {
  if (!isset($result)) {
    return FALSE;
  }
  if (empty($result)) {
    return FALSE;
  }
  if (!is_array($result)) {
    return FALSE;
  }
  if (!isset($result['status'])) {
    return FALSE;
  }
  if ($result['status'] = 'failed') {
    return FALSE;
  }

  // All seems OK, so returning TRUE.
  return TRUE;
}