Example #1
0
 public function __construct(Context $context)
 {
     parent::__construct($context);
     $this->type = 'RouteParams';
     if (isset($context->getCaller()->annotations['canonical'])) {
         $this->routeParams = Url::extract($context->getCaller()->annotations['canonical'], $context->getUrl()->requestUri);
     }
 }
Example #2
0
 public static function createFromRequest(Request $request)
 {
     $self = new static($request->context);
     if (isset($request->context->getCaller()->annotations['canonical'])) {
         $self->setRouteParams(Url::extract($request->context->getCaller()->annotations['canonical'], $request->context->getUrl()->requestUri));
     } else {
         throw new Exception\MissingDocBlockException('RouteParams Request class requires @canonical DocBlock on calling method.');
     }
     return $self;
 }