WebRequestRecognizerTrait.php 524 B

123456789101112131415161718192021222324
  1. <?php declare(strict_types=1);
  2. /*
  3. * This file is part of the Monolog package.
  4. *
  5. * (c) Jordi Boggiano <j.boggiano@seld.be>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Monolog\Handler;
  11. trait WebRequestRecognizerTrait
  12. {
  13. /**
  14. * Checks if PHP's serving a web request
  15. * @return bool
  16. */
  17. protected function isWebRequest(): bool
  18. {
  19. return 'cli' !== \PHP_SAPI && 'phpdbg' !== \PHP_SAPI;
  20. }
  21. }