kartik\helpers\Enum::isEmpty PHP Method

isEmpty() public static method

Example: ~~~ if (Enum::isEmpty([]) { echo 'Not empty'; } ~~~
public static isEmpty ( mixed $var ) : boolean
$var mixed variable to perform the check
return boolean
    public static function isEmpty($var)
    {
        return !isset($var) ? true : (is_array($var) ? empty($var) : $var === null || $var === '');
    }

Usage Example

Example #1
0
 /**
  * Generates panel title for heading and footer.
  *
  * @param array $content the panel content settings.
  * @param string $type whether `heading` or `footer`
  *
  * @return string
  */
 protected static function getPanelTitle($content, $type)
 {
     $title = ArrayHelper::getValue($content, $type, '');
     if (!Enum::isEmpty($title)) {
         if (ArrayHelper::getValue($content, "{$type}Title", true) === true) {
             $title = static::tag("h3", $title, ["class" => "panel-title"]);
         }
         return static::tag("div", $title, ["class" => "panel-{$type}"]) . "\n";
     } else {
         return '';
     }
 }
All Usage Examples Of kartik\helpers\Enum::isEmpty