|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; |
|
|
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; |
|
|
|
|
|
use Symfony\Component\HttpFoundation\RequestStack; |
|
|
|
|
|
|
|
|
class UrlResolver |
|
|
class UrlResolver |
|
|
{ |
|
|
{ |
|
|
protected ParameterBagInterface $parameterBag; |
|
|
protected ParameterBagInterface $parameterBag; |
|
|
|
|
|
protected RequestStack $requestStack; |
|
|
|
|
|
|
|
|
public function __construct(ParameterBagInterface $parameterBag) |
|
|
|
|
|
|
|
|
public function __construct(ParameterBagInterface $parameterBag, RequestStack $requestStack) |
|
|
{ |
|
|
{ |
|
|
$this->parameterBag = $parameterBag; |
|
|
$this->parameterBag = $parameterBag; |
|
|
|
|
|
$this->requestStack = $requestStack; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public function isServerLocalhost(): bool |
|
|
public function isServerLocalhost(): bool |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public function isInAdminArea(): bool |
|
|
|
|
|
{ |
|
|
|
|
|
$requestAttributes = $this->requestStack->getCurrentRequest()->attributes->all(); |
|
|
|
|
|
$route = isset($requestAttributes['_route']) ? $requestAttributes['_route'] : false; |
|
|
|
|
|
|
|
|
|
|
|
return $route && ($route == 'easyadmin' || strpos($route, 'admin_') !== false) ; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |