You are here

public static function SettingsHelper::isInvalidCredential in Acquia Lift Connector 8

Same name and namespace in other branches
  1. 8.4 src/Service/Helper/SettingsHelper.php \Drupal\acquia_lift\Service\Helper\SettingsHelper::isInvalidCredential()
  2. 8.3 src/Service/Helper/SettingsHelper.php \Drupal\acquia_lift\Service\Helper\SettingsHelper::isInvalidCredential()

Is an invalid credential.

Parameters

array: Credential settings array.

Return value

boolean True if is an invalid credential.

5 calls to SettingsHelper::isInvalidCredential()
acquia_lift_requirements in ./acquia_lift.install
Implements hook_requirements().
AdminSettingsForm::buildCredentialForm in src/Form/AdminSettingsForm.php
Build credential form.
DataApi::__construct in src/Service/Api/DataApi.php
Constructor.
PathContext::shouldAttach in src/Service/Context/PathContext.php
Should attach.
SettingsHelperTest::testIsInvalidCredential in tests/src/Unit/Service/Helper/SettingsHelperTest.php
Tests the isInvalidCredential() method.

File

src/Service/Helper/SettingsHelper.php, line 53
Contains \Drupal\acquia_lift\Service\Helper\SettingsHelper.

Class

SettingsHelper
Defines the Settings Helper class.

Namespace

Drupal\acquia_lift\Service\Helper

Code

public static function isInvalidCredential($credential_settings) {

  // Required credential need to be filled.
  if (empty($credential_settings['account_name']) || empty($credential_settings['api_url']) || empty($credential_settings['access_key']) || empty($credential_settings['secret_key']) || empty($credential_settings['js_path'])) {
    return TRUE;
  }

  // URLs need to be valid.
  if (!UrlHelper::isValid($credential_settings['api_url']) || !UrlHelper::isValid($credential_settings['js_path'])) {
    return TRUE;
  }
  return FALSE;
}