Example #1
0
 /**
  * @param Request|WebRequest $request
  * @throws error\HttpError
  * @return WebResponse
  */
 public function respond(Request $request)
 {
     if ($this->isContainerTarget($request)) {
         return ObjectTarget::factory($this->factory, $this)->create($request)->respond();
     }
     try {
         return $this->router->route($request)->respond();
     } catch (TargetNotFoundException $e) {
         return $this->tryToRouteInParentClass($request, $e);
     }
 }
Example #2
0
 public function givenTheTargetIsTheClass($fullClassName)
 {
     $object = $this->spec->factory->getInstance($fullClassName);
     $this->router = new NoneRouter(ObjectTarget::factory($this->spec->factory, $object));
 }
Example #3
0
 public function addObjectPath($pathString, $class, Factory $factory)
 {
     $this->addPath($pathString, ObjectTarget::factory($factory, $factory->getInstance($class)));
 }
Example #4
0
 private function whenIGetTheResponseFromTheTarget()
 {
     $this->factory->setSingleton(new DefaultFilterRegistry(), FilterRegistry::class);
     $target = ObjectTarget::factory($this->factory, $this->object)->create($this->request->request);
     $this->response = $target->respond();
 }