You are here

public static function Check::notEmpty in Hook Update Deploy Tools 8

Same name and namespace in other branches
  1. 7 src/Check.php \HookUpdateDeployTools\Check::notEmpty()

A strict check for !empty. Fails update if $value is empty.

Parameters

string $name: The name of a variable being checked for empty.

mixed $value: The actual value of the variable being checked for empty.

Return value

bool TRUE if $value is not empty.

Throws

HudtException if it is empty.

3 calls to Check::notEmpty()
Fields::deleteInstance in src/Fields.php
Deletes an instance of a field from and entity bundle.
PageManager::export in src/PageManager.php
Exports a single PageManager page (typically called from Drush).
Rules::export in src/Rules.php
Exports a single Rule when called (typically called from Drush).

File

src/Check.php, line 94

Class

Check
Public methods for dealing with Checking things.

Namespace

HookUpdateDeployTools

Code

public static function notEmpty($name, $value) {
  if (!empty($value)) {
    $return = TRUE;
  }
  else {

    // This is strict, so make message and throw DrupalUpdateException.
    $message = 'The required !name was empty. Could not proceed.';
    $vars = array(
      '!name' => $name,
    );
    throw new HudtException($message, $vars, WATCHDOG_ERROR, TRUE);
  }
  return $return;
}