Beans_Lessc::lib__sprintf PHP Method

lib__sprintf() protected method

protected lib__sprintf ( $args )
    protected function lib__sprintf($args)
    {
        if ($args[0] != "list") {
            return $args;
        }
        $values = $args[2];
        $string = array_shift($values);
        $template = $this->compileValue($this->lib_unquote($string));
        $i = 0;
        if (preg_match_all('/%[dsa]/', $template, $m)) {
            foreach ($m[0] as $match) {
                $val = isset($values[$i]) ? $this->reduce($values[$i]) : array('keyword', '');
                // lessjs compat, renders fully expanded color, not raw color
                if ($color = $this->coerceColor($val)) {
                    $val = $color;
                }
                $i++;
                $rep = $this->compileValue($this->lib_unquote($val));
                $template = preg_replace('/' . self::preg_quote($match) . '/', $rep, $template, 1);
            }
        }
        $d = $string[0] == "string" ? $string[1] : '"';
        return array("string", $d, array($template));
    }