Ejemplo n.º 1
0
 /**
  * @param Path|Url $context
  * @return static
  */
 public function withContext(Path $context)
 {
     if (!$context instanceof Url) {
         $context = $this->getContext()->with($context);
     }
     return parent::withContext($context);
 }
Ejemplo n.º 2
0
 private function createTargetFromClass($fullClassName, Request $request, Path $context)
 {
     $object = $this->factory->getInstance($fullClassName);
     $nextRequest = $request->withContext($request->getContext()->appendedAll($context->getElements()));
     $nextRequest = $nextRequest->withTarget(new Path(array_slice($request->getTarget()->getElements(), count($context->getElements()))));
     if ($object instanceof Responding) {
         return new RespondingTarget($nextRequest, $object);
     } else {
         return new ObjectTarget($nextRequest, $object, $this->factory);
     }
 }
Ejemplo n.º 3
0
 public function givenTheRequestHasTheContext($pathString)
 {
     $this->request = $this->request->withContext(Path::fromString($pathString));
 }