public function hasKey($key, $recursive = TRUE) {
    if (!($key instanceof ExpressionNode) && !is_scalar($key)) {
      throw new \InvalidArgumentException();
    }

    $keys = $this->getKeys($recursive);
    if (is_scalar($key)) {
      return $keys
        ->filter(Filter::isInstanceOf('\Pharborist\Types\ScalarNode'))
        ->is(function(ScalarNode $node) use ($key) {
          return $node->toValue() === $key;
        });
    }
    else {
      return $keys
        ->is(function(ExpressionNode $expr) use ($key) {
          return $expr->getText() === $key->getText();
        });
    }
  }
public function hasKey($key, $recursive = TRUE) {
    if (!($key instanceof ExpressionNode) && !is_scalar($key)) {
      throw new \InvalidArgumentException();
    }

    $keys = $this->getKeys($recursive);
    if (is_scalar($key)) {
      return $keys
        ->filter(Filter::isInstanceOf('\Pharborist\Types\ScalarNode'))
        ->is(function(ScalarNode $node) use ($key) {
          return $node->toValue() === $key;
        });
    }
    else {
      return $keys
        ->is(function(ExpressionNode $expr) use ($key) {
          return $expr->getText() === $key->getText();
        });
    }
  }
public function hasKey ( $ key , $ recursive = TRUE ) { if ( ! ( $ key instanceof ExpressionNode ) && ! is_scalar ( $ key ) ) { throw new \ InvalidArgumentException ( ) ; } $ keys = $ this -> getKeys ( $ recursive ) ; if ( is_scalar ( $ key ) ) { return $ keys -> filter ( Filter :: isInstanceOf ( '\Pharborist\Types\ScalarNode' ) ) -> is ( function ( ScalarNode $ node ) use ( $ key ) { return $ node -> toValue ( ) === $ key ; } ) ; } else { return $ keys -> is ( function ( ExpressionNode $ expr ) use ( $ key ) { return $ expr -> getText ( ) === $ key -> getText ( ) ; } ) ; } }
Returns if the array has a specific key.

@param mixed $key
Either a scalar value ('foo') or an ExpressionNode representing the key.
If $key is an ExpressionNode, the key's string representation is compared
with the string representations of the array keys. Otherwise, the actual
value is compared.
@param boolean $recursive
Whether or not to check every level of the array.

@return boolean

@throws \InvalidArgumentException
Returns if the array has a specific key .