public function match(RuleScope
$scope): bool
{ if ($scope instanceof LineItemScope
) { return $this->
isFreeDeliveryItem($scope->
getLineItem()) ===
$this->allowed;
} if (!
$scope instanceof CartRuleScope
) { return false;
} $hasFreeDeliveryItems =
$this->
hasFreeDeliveryItems($scope->
getCart()->
getLineItems());
return $hasFreeDeliveryItems ===
$this->allowed;
} public function getConstraints(): array
{ return [ 'allowed' => RuleConstraints::
bool(),
];
}