You are here

public static function SassPropertyNode::isa in Sassy 7

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

* Returns a value indicating if the token represents this type of node. *

Parameters

object token: * @param string the property syntax being used * @return boolean true if the token represents this type of node, false if not

Overrides SassNode::isa

1 call to SassPropertyNode::isa()
SassParser::getNode in phamlp/sass/SassParser.php
* Creates and returns the next SassNode. * The tpye of SassNode depends on the content of the SassToken. *

File

phamlp/sass/tree/SassPropertyNode.php, line 180

Class

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

Code

public static function isa($token) {
  if (!is_array($token)) {
    $syntax = 'old';
  }
  else {
    $syntax = $token['syntax'];
    $token = $token['token'];
  }
  $matches = self::match($token, $syntax);
  if (!empty($matches)) {
    if (isset($matches[self::VALUE]) && self::isPseudoSelector($matches[self::VALUE])) {
      return false;
    }
    if ($token->level === 0) {
      throw new SassPropertyNodeException('Properties can not be assigned at root level', array(), null);
    }
    else {
      return true;
    }
  }
  else {
    return false;
  }
}