private function applyAttribs(Tokens $tokens, $index, array $attribs)
    {
        $toInsert = [];

        foreach ($attribs as $attrib) {
            if (null !== $attrib && '' !== $attrib->getContent()) {
                $toInsert[] = $attrib;
                $toInsert[] = new Token([T_WHITESPACE, ' ']);
            }
        }

        if (!empty($toInsert)) {
            $tokens->insertAt($index, $toInsert);
        }
    }
private function applyAttribs(Tokens $tokens, $index, array $attribs)
    {
        $toInsert = [];

        foreach ($attribs as $attrib) {
            if (null !== $attrib && '' !== $attrib->getContent()) {
                $toInsert[] = $attrib;
                $toInsert[] = new Token([T_WHITESPACE, ' ']);
            }
        }

        if (!empty($toInsert)) {
            $tokens->insertAt($index, $toInsert);
        }
    }
private function applyAttribs ( Tokens $ tokens , $ index , array $ attribs ) { $ toInsert = [ ] ; foreach ( $ attribs as $ attrib ) { if ( null !== $ attrib && '' !== $ attrib -> getContent ( ) ) { $ toInsert [ ] = $ attrib ; $ toInsert [ ] = new Token ( [ T_WHITESPACE , ' ' ] ) ; } } if ( ! empty ( $ toInsert ) ) { $ tokens -> insertAt ( $ index , $ toInsert ) ; } }
Apply token attributes.

Token at given index is prepended by attributes.

@param Tokens $tokens  Tokens collection
@param int    $index   token index
@param array  $attribs array of token attributes
Apply token attributes .