/** * @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); } }
public function givenTheTargetIsTheClass($fullClassName) { $object = $this->spec->factory->getInstance($fullClassName); $this->router = new NoneRouter(ObjectTarget::factory($this->spec->factory, $object)); }
public function addObjectPath($pathString, $class, Factory $factory) { $this->addPath($pathString, ObjectTarget::factory($factory, $factory->getInstance($class))); }
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(); }