lib/Tokenizer.php
protected function _findRulePairs($words)
    {
        $key = '';
        $value = '';
        $isKey = true;
        $hasFunction = false;

        foreach ($words as $word) {
            if ($word['type'] !== 'text') {
                if ($isKey) {
                    if (!$this->lessSyntax) {
                        // Cannot have URL or quoted string in key
                        return false;
                    }

                    // Check for function
                    if ($word['type'] === 'function') {
                        $hasFunction = true;
                    }
                    $key .= $word['text'];
                    continue;
                }
                $value .= $word['text'];
                continue;
            }

            $pairs = explode(':', $word['text']);
            if ($this->lessSyntax && count($pairs) > 1) {
                // Check for "&:extend" LESS syntax
                $updated = false;
                for ($index = 1; $index < count($pairs); $index ++) {
                    if ($pairs[$index] === 'extend' || substr($pairs[$index], 0, 7) === 'extend(') {
                        $pairs[$index - 1] .= $pairs[$index];
                        $pairs[$index] = null;
                        $updated = true;
                    }
                }

                if ($updated) {
                    $newPairs = [];
                    foreach ($pairs as $item) {
                        if ($item !== null) {
                            $newPairs[] = $item;
                        }
                    }
                    $pairs = $newPairs;
                }
            }

            if (count($pairs) > 2) {
                return false;
            }
            if (count($pairs) === 2) {
                if (!$isKey) {
                    return false;
                }
                $key .= $pairs[0];
                $value = $pairs[1];
                $isKey = false;
                continue;
            }
            if ($isKey) {
                $key .= $word['text'];
            } else {
                $value .= $word['text'];
            }
        }

        if ($isKey) {
            // True if token should be treated as code
            return $this->lessSyntax ? $hasFunction || substr(trim($key), 0, 1) === '@' : false;
        }

        $key = trim($key);
        $value = trim($value);
        if (!strlen($key) || !strlen($value)) {
            return false;
        }

        $result = [
            'token' => 'rule',
            'key'   => $key,
            'value' => $value,
            'index' => $words[0]['index'],
        ];

        foreach($this->ruleModifiers as $word) {
            if (strtolower(substr($result['value'], -1 - strlen($word))) === '!' . $word) {
                $result[$word] = true;
                $result['value'] = trim(substr($result['value'], 0, strlen($result['value']) - strlen($word) - 1));
                if (!strlen($result['value'])) {
                    return false;
                }
            }
        }

        return $result;
    }
protected function _findRulePairs($words)
    {
        $key = '';
        $value = '';
        $isKey = true;
        $hasFunction = false;

        foreach ($words as $word) {
            if ($word['type'] !== 'text') {
                if ($isKey) {
                    if (!$this->lessSyntax) {
                        // Cannot have URL or quoted string in key
                        return false;
                    }

                    // Check for function
                    if ($word['type'] === 'function') {
                        $hasFunction = true;
                    }
                    $key .= $word['text'];
                    continue;
                }
                $value .= $word['text'];
                continue;
            }

            $pairs = explode(':', $word['text']);
            if ($this->lessSyntax && count($pairs) > 1) {
                // Check for "&:extend" LESS syntax
                $updated = false;
                for ($index = 1; $index < count($pairs); $index ++) {
                    if ($pairs[$index] === 'extend' || substr($pairs[$index], 0, 7) === 'extend(') {
                        $pairs[$index - 1] .= $pairs[$index];
                        $pairs[$index] = null;
                        $updated = true;
                    }
                }

                if ($updated) {
                    $newPairs = [];
                    foreach ($pairs as $item) {
                        if ($item !== null) {
                            $newPairs[] = $item;
                        }
                    }
                    $pairs = $newPairs;
                }
            }

            if (count($pairs) > 2) {
                return false;
            }
            if (count($pairs) === 2) {
                if (!$isKey) {
                    return false;
                }
                $key .= $pairs[0];
                $value = $pairs[1];
                $isKey = false;
                continue;
            }
            if ($isKey) {
                $key .= $word['text'];
            } else {
                $value .= $word['text'];
            }
        }

        if ($isKey) {
            // True if token should be treated as code
            return $this->lessSyntax ? $hasFunction || substr(trim($key), 0, 1) === '@' : false;
        }

        $key = trim($key);
        $value = trim($value);
        if (!strlen($key) || !strlen($value)) {
            return false;
        }

        $result = [
            'token' => 'rule',
            'key'   => $key,
            'value' => $value,
            'index' => $words[0]['index'],
        ];

        foreach($this->ruleModifiers as $word) {
            if (strtolower(substr($result['value'], -1 - strlen($word))) === '!' . $word) {
                $result[$word] = true;
                $result['value'] = trim(substr($result['value'], 0, strlen($result['value']) - strlen($word) - 1));
                if (!strlen($result['value'])) {
                    return false;
                }
            }
        }

        return $result;
    }
Get key/value pairs from list of words

@param array $words
@return array|bool