Use imports instead of FQNs

This commit is contained in:
Jan Böhmer 2023-06-11 14:55:06 +02:00
parent f63b6d7207
commit 5629215ce4
179 changed files with 792 additions and 597 deletions

View file

@ -22,17 +22,18 @@ declare(strict_types=1);
namespace App\Services\UserSystem;
use Symfony\Bundle\SecurityBundle\Security;
use Symfony\Component\HttpFoundation\Request;
use App\Entity\UserSystem\User;
use Locale;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\Security\Core\Security;
/**
* Purpose of this service is to generate a key unique for a user, to use in Cache keys and tags.
*/
class UserCacheKeyGenerator
{
public function __construct(protected \Symfony\Bundle\SecurityBundle\Security $security, protected RequestStack $requestStack)
public function __construct(protected Security $security, protected RequestStack $requestStack)
{
}
@ -46,10 +47,10 @@ class UserCacheKeyGenerator
{
$request = $this->requestStack->getCurrentRequest();
//Retrieve the locale from the request, if possible, otherwise use the default locale
$locale = $request instanceof \Symfony\Component\HttpFoundation\Request ? $request->getLocale() : Locale::getDefault();
$locale = $request instanceof Request ? $request->getLocale() : Locale::getDefault();
//If no user was specified, use the currently used one.
if (!$user instanceof \App\Entity\UserSystem\User) {
if (!$user instanceof User) {
$user = $this->security->getUser();
}