src/Drupal/Core/Template/Attribute.php
public function hasClass($class) {
    if (isset($this->storage['class']) && $this->storage['class'] instanceof AttributeArray) {
      return in_array($class, $this->storage['class']->value());
    }
    else {
      return FALSE;
    }
  }
public function hasClass($class) {
    if (isset($this->storage['class']) && $this->storage['class'] instanceof AttributeArray) {
      return in_array($class, $this->storage['class']->value());
    }
    else {
      return FALSE;
    }
  }
public function hasClass ( $ class ) { if ( isset ( $ this -> storage [ 'class' ] ) && $ this -> storage [ 'class' ] instanceof AttributeArray ) { return in_array ( $ class , $ this -> storage [ 'class' ] -> value ( ) ) ; } else { return FALSE ; } }
Checks if the class array has the given CSS class.

@param string $class
The CSS class to check for.

@return bool
Returns TRUE if the class exists, or FALSE otherwise.
Checks if the class array has the given CSS class .