original_string: public function addClass($class)
      {
          if (isset($this->attr['class'])) {
              $classes = explode(' ', $this->attr['class']);
              if (!in_array($class, $classes)) {
                  $classes[] = $class;
              }
  
              $this->attr['class'] = implode(' ', $classes);
          } else {
              $this->attr['class'] = $class;
          }
      }
code: public function addClass($class)
      {
          if (isset($this->attr['class'])) {
              $classes = explode(' ', $this->attr['class']);
              if (!in_array($class, $classes)) {
                  $classes[] = $class;
              }
  
              $this->attr['class'] = implode(' ', $classes);
          } else {
              $this->attr['class'] = $class;
          }
      }
code_tokens: public function addClass ( $ class ) { if ( isset ( $ this -> attr [ 'class' ] ) ) { $ classes = explode ( ' ' , $ this -> attr [ 'class' ] ) ; if ( ! in_array ( $ class , $ classes ) ) { $ classes [ ] = $ class ; } $ this -> attr [ 'class' ] = implode ( ' ' , $ classes ) ; } else { $ this -> attr [ 'class' ] = $ class ; } }
docstring: Add class to the "class" attribute.
  
  @param string $class Class name
docstring_tokens: Add class to the class attribute .