You are here

public function SassEachNode::__construct in Sassy 7.3

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

SassEachNode constructor.

Parameters

object source token:

Return value

SassEachNode

Overrides SassNode::__construct

File

phpsass/tree/SassEachNode.php, line 45

Class

SassEachNode
SassEachNode class. Represents a Sass @each loop. @package PHamlP @subpackage Sass.tree

Code

public function __construct($token) {
  parent::__construct($token);
  if (!preg_match(self::MATCH, $token->source, $matches)) {
    if ($GLOBALS['SassParser_debug']) {
      throw new SassEachNodeException('Invalid @each directive', $this);
    }
  }
  else {
    $this->variable = trim($matches[self::VARIABLE]);
    if (count($bits = explode(',', $this->variable)) > 1) {
      $this->variable = trim(array_pop($bits), ' $,');
      $this->index_name = trim($bits[0], ' $,');
    }
    else {
      $this->index_name = 'i';
    }
    $this->in = $matches[self::IN];
  }
}