示例#1
0
 /**
  * @test
  */
 public function simpleForm()
 {
     Helper::addServiceClass(SimpleForm::class);
     $form = Helper::getService(SimpleForm::class);
     $builder = new ValidatorBuilder();
     $builder->enableAnnotationMapping();
     $validator = $builder->getValidator();
     $response = $validator->validate($form);
     $this->assertEquals(5, count($response));
 }
 private function invokeSessionAttributesRetrive()
 {
     if ($this->reflMethod->getDeclaringClass()->hasAnnotation(SessionAttributes::class)) {
         $storage = ServiceHelper::getService(DefaultSessionAttributeStore::class);
         foreach ($this->reflMethod->getDeclaringClass()->getAnnotations() as $annotation) {
             if ($annotation instanceof SessionAttributes) {
                 $ret = $storage->retrieveAttribute($annotation->name);
                 if ($ret !== null) {
                     $this->modelAttributes[$annotation->name] = $ret;
                 }
             }
         }
     }
 }
示例#3
0
 /**
  * @return integer Integer representation of request type
  */
 private static function getRequestMethodType()
 {
     $methodType = Helper::getService(HttpServletRequest::class)->getMethod();
     if (!is_int($methodType)) {
         /* @var $request IRequestHelper */
         $request = Helper::getService(IRequestHelper::class);
         $methodType = constant(RequestMethod::class . '::' . strtoupper($methodType)) | ($request->isXmlHttpRequest() ? RequestMethod::XMLHTTPREQUEST : 0);
     }
     return $methodType;
 }