SassScriptParser::makeSingular PHP Method

makeSingular() public static method

Reduces a set down to a singular form
public static makeSingular ( $operands )
    public static function makeSingular($operands)
    {
        if (count($operands) == 1) {
            return $operands[0];
        }
        $result = null;
        foreach ($operands as $i => $operand) {
            if (is_object($operand)) {
                if (!$result) {
                    $result = $operand;
                    continue;
                }
                if ($result instanceof SassString) {
                    $result = $result->op_concat($operand);
                } else {
                    $result = $result->op_plus($operand);
                }
            } else {
                $string = new SassString(' ');
                if (!$result) {
                    $result = $string;
                } else {
                    $result = $result->op_plus($string);
                }
            }
        }
        return $result ? $result : array_shift($operands);
    }