You are here

public static function Check::isNumeric in Hook Update Deploy Tools 7

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

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 numeric.

Throws

HudtException if it is !numeric.

3 calls to Check::isNumeric()
Groups::assignUsersToGroup in src/Groups.php
Add users to an Organic Group.
Nodes::export in src/Nodes.php
Exports a single Node based on its nid. (Typically called from Drush).
Terms::export in src/Terms.php
Exports a single term based on its tid. (Typically called from Drush).

File

src/Check.php, line 154
File for methods related to strictly checking things.

Class

Check
Public methods for dealing with Checking things.

Namespace

HookUpdateDeployTools

Code

public static function isNumeric($name, $value) {
  if (is_numeric($value)) {
    $return = TRUE;
  }
  else {

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