public __construct ( object $token, boolean $if = true ) : SassIfNode | ||
$token | object | source token |
$if | boolean | true for an "if" node, false for an "else if | else" node |
Résultat | SassIfNode |
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];
}
}
/** * SassElseNode constructor. * @param object source token * @return SassElseNode */ public function __construct($token) { parent::__construct($token, false); }