| Total Complexity | 7 |
| Total Lines | 42 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php declare(strict_types=1); |
||
| 14 | class IsActiveRule extends Rule |
||
| 15 | { |
||
| 16 | protected bool $isActive; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * @internal |
||
| 20 | */ |
||
| 21 | public function __construct(bool $isActive = false) |
||
| 22 | { |
||
| 23 | parent::__construct(); |
||
| 24 | $this->isActive = $isActive; |
||
| 25 | } |
||
| 26 | |||
| 27 | public function match(RuleScope $scope): bool |
||
| 28 | { |
||
| 29 | if (!$scope instanceof CheckoutRuleScope) { |
||
| 30 | return false; |
||
| 31 | } |
||
| 32 | |||
| 33 | $customer = $scope->getSalesChannelContext()->getCustomer(); |
||
| 34 | if (!$customer) { |
||
| 35 | return false; |
||
| 36 | } |
||
| 37 | |||
| 38 | return $this->isActive === $customer->getActive(); |
||
| 39 | } |
||
| 40 | |||
| 41 | public function getName(): string |
||
| 44 | } |
||
| 45 | |||
| 46 | public function getConfig(): RuleConfig |
||
| 50 | } |
||
| 51 | |||
| 52 | public function getConstraints(): array |
||
| 59 |