SassParser::getLevel PHP Method

getLevel() public method

Used for .sass source
public getLevel ( string $source ) : integer
$source string the source
return integer the level of the source
    public function getLevel($source)
    {
        $indent = strlen($source) - strlen(ltrim($source));
        $level = $indent / $this->indentSpaces;
        if (is_float($level)) {
            $level = (int) ceil($level);
        }
        if (!is_int($level) || preg_match("/[^{$this->indentChar}]/", substr($source, 0, $indent))) {
            $this->source = $source;
            if ($this->debug) {
                throw new SassException('Invalid indentation', $this);
            } else {
                return 0;
            }
        }
        return $level;
    }