You are here

function cf_is_empty_or_non_string in Common Functionality 7

Same name and namespace in other branches
  1. 7.2 cf.module \cf_is_empty_or_non_string()

Checks if a variable is an empty string is empty or not a string at all.

Why: Checking that a string is empty may also require a check to see if a variable is a string. This provides a way to do that two step process in 1 step. Do not use this for any other purpose.

Parameters

array $function_history: An array of function names, ie: array('0' => 'my_function_name').

string $argument_name: The variable name of the argument in question.

$variable: The argument that is to be validated.

int $severity: (optional) This is passed directly to watchdog and represents the severity of the report.

Return value

bool When the check passed returns TRUE, FALSE otherwise.

6 calls to cf_is_empty_or_non_string()
cf_has_array_key in ./cf.module
Check to see if the variable is an array and if the given key exists.
cf_http_get_response in modules/cf_http/cf_http.module
Reads an http page at the given path and returns an unprocessed response.
cf_http_parse_response in modules/cf_http/cf_http.module
Accepts and processes provided http content.
cf_http_split_response in modules/cf_http/cf_http.module
Breaks apart an html formatted document string.
cf_node_create in modules/cf_node/cf_node.module
Programatically creates a node of the form type and returns any errors. This flushes the error buffer allowing for multiple calls. This will always return an array.

... See full list

File

./cf.module, line 359

Code

function cf_is_empty_or_non_string($function_history, $argument_name, $variable, $severity = WATCHDOG_WARNING) {
  cf_error_append_history($function_history, __FUNCTION__);
  if ($argument_name == '') {
    cf_error_empty_string($function_history, 'argument_name');
  }
  if (!is_string($variable)) {
    cf_error_not_string($function_history, $argument_name, $severity);
    return TRUE;
  }
  if ($variable == '') {
    cf_error_empty_string($function_history, $argument_name, $severity);
    return TRUE;
  }
  return FALSE;
}