3 namespace Wallabag\CoreBundle\Helper
;
5 use Symfony\Component\Routing\Router
;
6 use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage
;
9 * Manage redirections to avoid redirecting to empty routes.
14 private $actionMarkAsRead;
16 public function __construct(Router
$router, TokenStorage
$token)
18 $this->router
= $router;
19 $this->actionMarkAsRead
= $token->getToken()->getUser()->getConfig()->getActionMarkAsRead();
23 * @param string $url URL to redirect
24 * @param string $fallback Fallback URL if $url is null
28 public function to($url, $fallback = '')
30 if ($this->actionMarkAsRead
== 0) {
31 return $this->router
->generate('homepage');
38 if ('' === $fallback) {
39 return $this->router
->generate('homepage');