You are here

public function SassIfNode::__construct in Sassy 7.3

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

SassIfNode constructor.

Parameters

object source token:

boolean true for an "if" node, false for an "else if | else" node:

Return value

SassIfNode

Overrides SassNode::__construct

1 call to SassIfNode::__construct()
SassElseNode::__construct in phpsass/tree/SassElseNode.php
SassElseNode constructor.
1 method overrides SassIfNode::__construct()
SassElseNode::__construct in phpsass/tree/SassElseNode.php
SassElseNode constructor.

File

phpsass/tree/SassIfNode.php, line 40

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 __construct($token, $if = true) {
  parent::__construct($token);
  if ($if) {
    preg_match(self::MATCH_IF, $token->source, $matches);
    $this->expression = $matches[SassIfNode::IF_EXPRESSION];
  }
  else {
    preg_match(self::MATCH_ELSE, $token->source, $matches);
    $this->expression = sizeof($matches) == 1 ? null : $matches[SassIfNode::ELSE_EXPRESSION];
  }
}