You are here

protected function ShortcodeService::isBool in Shortcode 8

Same name and namespace in other branches
  1. 2.0.x src/ShortcodeService.php \Drupal\shortcode\ShortcodeService::isBool()

Helper function to decide the given param is a bool value.

Parameters

mixed $var: The variable.

Return value

bool TRUE if $var is a booleany value.

File

src/ShortcodeService.php, line 194

Class

ShortcodeService
Provide the ShortCode service.

Namespace

Drupal\shortcode

Code

protected function isBool($var) {
  switch (strtolower($var)) {
    case FALSE:
    case 'false':
    case 'no':
    case '0':
      $res = FALSE;
      break;
    default:
      $res = TRUE;
      break;
  }
  return $res;
}