vendor/shopware/core/Checkout/Cart/CartBehavior.php line 7

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace Shopware\Core\Checkout\Cart;
  3. use Shopware\Core\Framework\Struct\Struct;
  4. class CartBehavior extends Struct
  5. {
  6.     /**
  7.      * @var array
  8.      */
  9.     private $permissions = [];
  10.     private bool $hookAware;
  11.     public function __construct(array $permissions = [], bool $hookAware true)
  12.     {
  13.         $this->permissions $permissions;
  14.         $this->hookAware $hookAware;
  15.     }
  16.     /**
  17.      * @deprecated tag:v6.5.0 - Return type will change to bool
  18.      *
  19.      * @phpstan-ignore-next-line when return type will be added we can remove the ignore
  20.      */
  21.     public function hasPermission(string $permission)
  22.     {
  23.         return !empty($this->permissions[$permission]);
  24.     }
  25.     public function getApiAlias(): string
  26.     {
  27.         return 'cart_behavior';
  28.     }
  29.     public function hookAware(): bool
  30.     {
  31.         return $this->hookAware;
  32.     }
  33.     /**
  34.      * @internal
  35.      *
  36.      * @return mixed
  37.      */
  38.     public function disableHooks(\Closure $closure)
  39.     {
  40.         $before $this->hookAware;
  41.         $this->hookAware false;
  42.         $result $closure();
  43.         $this->hookAware $before;
  44.         return $result;
  45.     }
  46. }