Beispiel #1
0
 public function testHas()
 {
     $context = new Context();
     $this->assertFalse($context->has('token.name'));
     $context->push($this->getTokenMock('token.name'));
     $this->assertTrue($context->has('token.name'));
 }
 protected function validate(Context $context)
 {
     if ($context->language !== $this->rule->language) {
         $this->setValid(false);
         return false;
     }
     if (!$context->has($this->name)) {
         if (!$this->rule->validator->validate($context)) {
             $this->setValid(false);
         } else {
             $this->_valid = true;
             $this->_end->_valid = false;
         }
     } else {
         if (!$this->rule->validator->validate($context, [$this->name => Validator::CONTEXT_IN])) {
             $this->setValid(false);
         } else {
             $this->_valid = false;
             $this->_end->_valid = true;
         }
     }
     $this->_end->_start = false;
     $this->_end = false;
     return true;
 }