Leafo\ScssPhp\Compiler::coerceList PHP Method

coerceList() protected method

Coerce something to list
protected coerceList ( array $item, $delim = ',' ) : array
$item array
return array
    protected function coerceList($item, $delim = ',')
    {
        if (isset($item) && $item[0] === Type::T_LIST) {
            return $item;
        }
        if (isset($item) && $item[0] === Type::T_MAP) {
            $keys = $item[1];
            $values = $item[2];
            $list = [];
            for ($i = 0, $s = count($keys); $i < $s; $i++) {
                $key = $keys[$i];
                $value = $values[$i];
                $list[] = [Type::T_LIST, '', [[Type::T_KEYWORD, $this->compileStringContent($this->coerceString($key))], $value]];
            }
            return [Type::T_LIST, ',', $list];
        }
        return [Type::T_LIST, $delim, !isset($item) ? [] : [$item]];
    }
Compiler