public function __construct(KernelInterface $kernel)
{
parent::__construct($kernel);
// add ourself to the reference so other classes can retrieve us
$this->getContainer()->set('url', $this);
// fetch the request object from the container
$this->request = $this->get('request');
// if there is a trailing slash we permanent redirect to the page without slash
if (mb_strlen($this->request->getRequestUri()) != 1 && mb_substr($this->request->getRequestUri(), -1) == '/') {
throw new RedirectException('Redirect', new RedirectResponse(mb_substr($this->request->getRequestUri(), 0, -1), 301));
}
// set query-string and parameters for later use
$this->parameters = $this->request->query->all();
// process URL
$this->processQueryString();
}