vendor/shopware/core/Framework/Routing/Annotation/RouteScope.php line 41

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace Shopware\Core\Framework\Routing\Annotation;
  3. use Sensio\Bundle\FrameworkExtraBundle\Configuration\ConfigurationAnnotation;
  4. use Shopware\Core\Framework\Feature;
  5. use Shopware\Core\Framework\Log\Package;
  6. /**
  7. * @deprecated tag:v6.5.0 - Use route defaults with "_routeScope". Example: @Route(defaults={"_routeScope"={"storefront"}})
  8. * @Annotation
  9. *
  10. * @Attributes({
  11. * @Attribute("scopes", type = "array"),
  12. * })
  13. */
  14. #[Package('core')]
  15. class RouteScope extends ConfigurationAnnotation
  16. {
  17. /**
  18. * @var array
  19. */
  20. private $scopes;
  21. /**
  22. * @return string
  23. */
  24. public function getAliasName()
  25. {
  26. Feature::triggerDeprecationOrThrow(
  27. 'v6.5.0.0',
  28. Feature::deprecatedClassMessage(__CLASS__, 'v6.5.0.0', '"@Route(defaults={"_routeScope"={"storefront"}})"')
  29. );
  30. return 'routeScope';
  31. }
  32. /**
  33. * @return bool
  34. */
  35. public function allowArray()
  36. {
  37. Feature::triggerDeprecationOrThrow(
  38. 'v6.5.0.0',
  39. Feature::deprecatedClassMessage(__CLASS__, 'v6.5.0.0', '"@Route(defaults={"_routeScope"={"storefront"}})"')
  40. );
  41. return false;
  42. }
  43. public function getScopes(): array
  44. {
  45. Feature::triggerDeprecationOrThrow(
  46. 'v6.5.0.0',
  47. Feature::deprecatedClassMessage(__CLASS__, 'v6.5.0.0', '"@Route(defaults={"_routeScope"={"storefront"}})"')
  48. );
  49. return $this->scopes;
  50. }
  51. public function setScopes(array $scopes): void
  52. {
  53. Feature::triggerDeprecationOrThrow(
  54. 'v6.5.0.0',
  55. Feature::deprecatedClassMessage(__CLASS__, 'v6.5.0.0', '"@Route(defaults={"_routeScope"={"storefront"}})"')
  56. );
  57. $this->scopes = $scopes;
  58. }
  59. public function hasScope(string $scopeName): bool
  60. {
  61. Feature::triggerDeprecationOrThrow(
  62. 'v6.5.0.0',
  63. Feature::deprecatedClassMessage(__CLASS__, 'v6.5.0.0', '"@Route(defaults={"_routeScope"={"storefront"}})"')
  64. );
  65. return \in_array($scopeName, $this->scopes, true);
  66. }
  67. }