You are here

public static function SassPropertyNode::isa in Sassy 7.3

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

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

Parameters

object token:

string the property syntax being used:

Return value

boolean true if the token represents this type of node, false if not

Overrides SassNode::isa

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

File

phpsass/tree/SassPropertyNode.php, line 179

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) {

      # RL - if it's on the first level it's probably a false positive, not an error.

      # even if it is a genuine error, no need to kill the compiler about it.
      return false;

      // throw new SassPropertyNodeException('Properties can not be assigned at root level', $token);
    }
    else {
      return true;
    }
  }
  else {
    return false;
  }
}