|
1234567891011121314151617181920212223242526272829303132333435363738 |
- <?php
- /**
- * @author La clic ! <contact@laclic.fr>
- */
-
-
- namespace Lc\SovBundle\Resolver;
-
-
- use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
-
- class UrlResolver
- {
- protected ParameterBagInterface $parameterBag;
-
- public function __construct(ParameterBagInterface $parameterBag)
- {
- $this->parameterBag = $parameterBag;
- }
-
- public function isServerLocalhost()
- {
- return in_array($_SERVER['REMOTE_ADDR'], ['127.0.0.1', '::1']);
- }
-
- public function isBot()
- {
- if (isset($_SERVER['HTTP_USER_AGENT']) && preg_match(
- '/bot|crawl|slurp|spider/i',
- $_SERVER['HTTP_USER_AGENT']
- )) {
- return true;
- } else {
- return false;
- }
- }
-
- }
|