protected function parseClassAttribute()
    {
        if (!$this->element->hasAttribute('class')) {
            // possible if class attribute has been removed
            if ($this->classesString !== '') {
                $this->classesString = '';
                $this->classes = [];
            }

            return;
        }

        // if class attribute is not changed
        if ($this->element->getAttribute('class') === $this->classesString) {
            return;
        }

        // save class attribute as is (without trimming)
        $this->classesString = $this->element->getAttribute('class');

        $classesString = trim($this->classesString);

        if ($classesString === '') {
            $this->classes = [];

            return;
        }

        $classes = explode(' ', $classesString);

        $classes = array_map('trim', $classes);
        $classes = array_filter($classes);
        $classes = array_unique($classes);

        $this->classes = array_values($classes);
    }
protected function parseClassAttribute()
    {
        if (!$this->element->hasAttribute('class')) {
            // possible if class attribute has been removed
            if ($this->classesString !== '') {
                $this->classesString = '';
                $this->classes = [];
            }

            return;
        }

        // if class attribute is not changed
        if ($this->element->getAttribute('class') === $this->classesString) {
            return;
        }

        // save class attribute as is (without trimming)
        $this->classesString = $this->element->getAttribute('class');

        $classesString = trim($this->classesString);

        if ($classesString === '') {
            $this->classes = [];

            return;
        }

        $classes = explode(' ', $classesString);

        $classes = array_map('trim', $classes);
        $classes = array_filter($classes);
        $classes = array_unique($classes);

        $this->classes = array_values($classes);
    }
protected function parseClassAttribute ( ) { if ( ! $ this -> element -> hasAttribute ( 'class' ) ) { // possible if class attribute has been removed if ( $ this -> classesString !== '' ) { $ this -> classesString = '' ; $ this -> classes = [ ] ; } return ; } // if class attribute is not changed if ( $ this -> element -> getAttribute ( 'class' ) === $ this -> classesString ) { return ; } // save class attribute as is (without trimming) $ this -> classesString = $ this -> element -> getAttribute ( 'class' ) ; $ classesString = trim ( $ this -> classesString ) ; if ( $ classesString === '' ) { $ this -> classes = [ ] ; return ; } $ classes = explode ( ' ' , $ classesString ) ; $ classes = array_map ( 'trim' , $ classes ) ; $ classes = array_filter ( $ classes ) ; $ classes = array_unique ( $ classes ) ; $ this -> classes = array_values ( $ classes ) ; }
Parses class attribute of the element.
Parses class attribute of the element .