/** * Get the controller context * * @param ControllerContextInterface $context Context to cast to a local context * @return ControllerContext */ public function getContext(ControllerContextInterface $context = null) { $context = new ControllerContext($context); $context->setRequest($this->getRequest()); $context->setResponse($this->getResponse()); $context->setUser($this->getUser()); return $context; }