You are here

public function SassIfNode::__construct in Sassy 7

Same name and namespace in other branches
  1. 7.3 phpsass/tree/SassIfNode.php \SassIfNode::__construct()

* SassIfNode constructor. *

Parameters

object source token: * @param boolean true for an "if" node, false for an "else if | else" node * @return SassIfNode

Overrides SassNode::__construct

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

File

phamlp/sass/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];
  }
}