Leafo\ScssPhp\Compiler::combineSelectorSingle PHP Method

combineSelectorSingle() protected method

Combine selector single
protected combineSelectorSingle ( array $base, array $other ) : array
$base array
$other array
return array
    protected function combineSelectorSingle($base, $other)
    {
        $tag = [];
        $out = [];
        $wasTag = true;
        foreach ([$base, $other] as $single) {
            foreach ($single as $part) {
                if (preg_match('/^[\\[.:#]/', $part)) {
                    $out[] = $part;
                    $wasTag = false;
                } elseif (preg_match('/^[^_-]/', $part)) {
                    $tag[] = $part;
                    $wasTag = true;
                } elseif ($wasTag) {
                    $tag[count($tag) - 1] .= $part;
                } else {
                    $out[count($out) - 1] .= $part;
                }
            }
        }
        if (count($tag)) {
            array_unshift($out, $tag[0]);
        }
        return $out;
    }
Compiler