You are here

function _drupal_rewrite_settings_is_simple in Drupal 9

Same name and namespace in other branches
  1. 8 core/includes/install.inc \_drupal_rewrite_settings_is_simple()
  2. 10 core/includes/install.inc \_drupal_rewrite_settings_is_simple()

Helper for drupal_rewrite_settings().

Checks whether this token represents a scalar or NULL.

Parameters

int $type: The token type.

string $value: The value of the token.

Return value

bool TRUE if this token represents a scalar or NULL.

See also

token_name()

1 call to _drupal_rewrite_settings_is_simple()
drupal_rewrite_settings in core/includes/install.inc
Replaces values in settings.php with values in the submitted array.

File

core/includes/install.inc, line 421
API functions for installing modules and themes.

Code

function _drupal_rewrite_settings_is_simple($type, $value) {
  $is_integer = $type == T_LNUMBER;
  $is_float = $type == T_DNUMBER;
  $is_string = $type == T_CONSTANT_ENCAPSED_STRING;
  $is_boolean_or_null = $type == T_STRING && in_array(strtoupper($value), [
    'TRUE',
    'FALSE',
    'NULL',
  ]);
  return $is_integer || $is_float || $is_string || $is_boolean_or_null;
}