Leafo\ScssPhp\Compiler::compileImport PHP Method

compileImport() protected method

Compile import; returns true if the value was something that could be imported
protected compileImport ( array $rawPath, array $out, boolean $once = false ) : boolean
$rawPath array
$out array
$once boolean
return boolean
    protected function compileImport($rawPath, $out, $once = false)
    {
        if ($rawPath[0] === Type::T_STRING) {
            $path = $this->compileStringContent($rawPath);
            if ($path = $this->findImport($path)) {
                if (!$once || !in_array($path, $this->importedFiles)) {
                    $this->importFile($path, $out);
                    $this->importedFiles[] = $path;
                }
                return true;
            }
            return false;
        }
        if ($rawPath[0] === Type::T_LIST) {
            // handle a list of strings
            if (count($rawPath[2]) === 0) {
                return false;
            }
            foreach ($rawPath[2] as $path) {
                if ($path[0] !== Type::T_STRING) {
                    return false;
                }
            }
            foreach ($rawPath[2] as $path) {
                $this->compileImport($path, $out);
            }
            return true;
        }
        return false;
    }
Compiler