Пример #1
0
 private function isOperator(Token $token)
 {
     static $arrayOperators = array(T_AND_EQUAL => true, T_BOOLEAN_AND => true, T_BOOLEAN_OR => true, T_CONCAT_EQUAL => true, T_DIV_EQUAL => true, T_DOUBLE_ARROW => true, T_IS_EQUAL => true, T_IS_GREATER_OR_EQUAL => true, T_IS_IDENTICAL => true, T_IS_NOT_EQUAL => true, T_IS_NOT_IDENTICAL => true, T_IS_SMALLER_OR_EQUAL => true, T_LOGICAL_AND => true, T_LOGICAL_OR => true, T_LOGICAL_XOR => true, T_MINUS_EQUAL => true, T_MOD_EQUAL => true, T_MUL_EQUAL => true, T_OR_EQUAL => true, T_PLUS_EQUAL => true, T_SL => true, T_SL_EQUAL => true, T_SR => true, T_SR_EQUAL => true, T_XOR_EQUAL => true);
     static $nonArrayOperators = array('=' => true);
     return $token->isArray() ? isset($arrayOperators[$token->id]) : isset($nonArrayOperators[$token->content]);
 }
Пример #2
0
 public function testIsEmpty()
 {
     $braceToken = $this->getBraceToken();
     $this->assertFalse($braceToken->isEmpty());
     $braceToken->content = '';
     $this->assertTrue($braceToken->isEmpty());
     $whitespaceToken = new Token(array(T_WHITESPACE, ' '));
     $this->assertFalse($whitespaceToken->isEmpty());
     $whitespaceToken->content = '';
     $this->assertFalse($whitespaceToken->isEmpty());
     $whitespaceToken->id = null;
     $this->assertTrue($whitespaceToken->isEmpty());
     $whitespaceToken = new Token(array(T_WHITESPACE, ' '));
     $whitespaceToken->clear();
     $this->assertTrue($whitespaceToken->isEmpty());
 }