You are here

public function SassPropertyNode::parse in Sassy 7.3

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

Parse this node. If the node is a property namespace return all parsed child nodes. If not return the parsed version of this node.

Parameters

SassContext the context in which this node is parsed:

Return value

array the parsed node

File

phpsass/tree/SassPropertyNode.php, line 96

Class

SassPropertyNode
SassPropertyNode class. Represents a CSS property. @package PHamlP @subpackage Sass.tree

Code

public function parse($context) {
  $return = array();
  if ($this->value !== "") {
    $node = clone $this;
    $node->name = ($this
      ->inNamespace() ? "{$this->namespace}-" : '') . $this
      ->interpolate($this->name, $context);
    $node->value = $this
      ->evaluate($this
      ->interpolate($this->value, $context), $context, SassScriptParser::CSS_PROPERTY)
      ->toString();
    if (array_key_exists($node->name, $this->vendor_properties)) {
      foreach ($this->vendor_properties[$node->name] as $vendorProperty) {
        $_node = clone $node;
        $_node->name = $vendorProperty;
        $return[] = $_node;
      }
    }
    $return[] = $node;
  }
  if ($this->children) {
    $return = array_merge($return, $this
      ->parseChildren($context));
  }
  return $return;
}