vendor/liip/imagine-bundle/Utility/Framework/SymfonyFramework.php line 36

Open in your IDE?
  1. <?php
  2. /*
  3. * This file is part of the `liip/LiipImagineBundle` project.
  4. *
  5. * (c) https://github.com/liip/LiipImagineBundle/graphs/contributors
  6. *
  7. * For the full copyright and license information, please view the LICENSE.md
  8. * file that was distributed with this source code.
  9. */
  10. namespace Liip\ImagineBundle\Utility\Framework;
  11. use Symfony\Component\HttpKernel\Kernel;
  12. /**
  13. * @internal
  14. */
  15. final class SymfonyFramework
  16. {
  17. public static function getContainerResolvableRootWebPath(): string
  18. {
  19. return sprintf('%%kernel.project_dir%%/%s', self::isKernelLessThan(4) ? 'web' : 'public');
  20. }
  21. public static function isKernelGreaterThanOrEqualTo(int $major, int $minor = null, int $patch = null): bool
  22. {
  23. return static::kernelVersionCompare('>=', $major, $minor, $patch);
  24. }
  25. public static function isKernelLessThan(int $major, int $minor = null, int $patch = null): bool
  26. {
  27. return static::kernelVersionCompare('<', $major, $minor, $patch);
  28. }
  29. private static function kernelVersionCompare(string $operator, int $major, int $minor = null, int $patch = null): bool
  30. {
  31. return version_compare(Kernel::VERSION_ID, sprintf("%d%'.02d%'.02d", $major, $minor ?: 0, $patch ?: 0), $operator);
  32. }
  33. }