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);
        }
    }