/** * Get the redirect response object. * * @param array $redirect * @param string $query * * @return \Symfony\Component\HttpFoundation\RedirectResponse */ private function getRedirectResponse(array $redirect, $query) { if (strpos($redirect['target'], 'http') === 0) { return $this->app->redirect($redirect['target'] . $query); } elseif ($redirectpage = $this->app['storage']->getContent($redirect['target'])) { return new RedirectResponse($redirectpage->link() . $query); } // No route found return; }
/** * Get the redirect response object. * * @param array $redirect * @param string $query * * @return \Symfony\Component\HttpFoundation\RedirectResponse|null */ private function getRedirectResponse(array $redirect, $query) { if (strpos($redirect['target'], 'http') === 0) { return $this->app->redirect($redirect['target'] . $query); } else { try { $url = '/' . ltrim($redirect['target'], '/'); $this->app['url_matcher']->match($url); return new RedirectResponse($url . $query); } catch (ResourceNotFoundException $e) { // No route found… Go home site admin, you're… um… putting a bad route in! return; } } }