You are here

public function SassIfNode::parse in Sassy 7.3

Same name and namespace in other branches
  1. 7 phamlp/sass/tree/SassIfNode.php \SassIfNode::parse()

Parse this node.

Parameters

SassContext the context in which this node is parsed:

Return value

array parsed child nodes

File

phpsass/tree/SassIfNode.php, line 74

Class

SassIfNode
SassIfNode class. Represents Sass If, Else If and Else statements. Else If and Else statement nodes are chained below the If statement node. @package PHamlP @subpackage Sass.tree

Code

public function parse($context) {
  if ($this
    ->isElse() || $this
    ->evaluate($this->expression, $context)
    ->toBoolean()) {
    $children = $this
      ->parseChildren($context);
  }
  elseif (!empty($this->else)) {
    $children = $this->else
      ->parse($context);
  }
  else {
    $children = array();
  }
  return $children;
}