You are here

private function HamlParser::hasChild in Sassy 7

* Returns a value indicating if the next line is a child of the parent line *

Parameters

array parent line: * @param boolean whether to all greater than the current indent * Used if the source line is a comment or a filter. * If true all indented lines are regarded as children; if not the child line * must only be indented by 1 or blank. Defaults to false. * @return boolean true if the next line is a child of the parent line * @throws Exception if the indent is invalid

2 calls to HamlParser::hasChild()
HamlParser::addChildren in phamlp/haml/HamlParser.php
* Adds children to a node if the current line has children. *
HamlParser::parseHamlComment in phamlp/haml/HamlParser.php
* Parse a Haml comment. * If the comment is an empty comment eat all child lines. *

File

phamlp/haml/HamlParser.php, line 516

Class

HamlParser
HamlParser class. Parses {@link http://haml-lang.com/ Haml} view files. @package PHamlP @subpackage Haml

Code

private function hasChild($line, $allowGreater = false) {
  if (!empty($this->source)) {
    $i = 0;
    $c = count($this->source);
    while (empty($nextLine[self::HAML_SOURCE]) && $i <= $c) {
      $nextLine = $this->source[$i++];
    }
    $level = $this
      ->getLevel($nextLine, $line['line'] + $i);
    if ($level == $line['level'] + 1 || $allowGreater && $level > $line['level']) {
      return true;
    }
    elseif ($level <= $line['level']) {
      return false;
    }
    else {
      throw new HamlException('Illegal indentation level ({level}); indentation level can only increase by one', array(
        '{level}' => $level,
      ), $this);
    }
  }
  else {
    return false;
  }
}