3 namespace Wallabag\CoreBundle\Helper
;
5 use Symfony\Component\Routing\Router
;
6 use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage
;
7 use Wallabag\CoreBundle\Entity\Config
;
10 * Manage redirections to avoid redirecting to empty routes.
15 private $actionMarkAsRead;
17 public function __construct(Router
$router, TokenStorage
$token)
19 $this->router
= $router;
20 $this->actionMarkAsRead
= $token->getToken()->getUser()->getConfig()->getActionMarkAsRead();
24 * @param string $url URL to redirect
25 * @param string $fallback Fallback URL if $url is null
29 public function to($url, $fallback = '')
31 if (Config
::REDIRECT_TO_HOMEPAGE
=== $this->actionMarkAsRead
) {
32 return $this->router
->generate('homepage');
39 if ('' === $fallback) {
40 return $this->router
->generate('homepage');