/**
* @return list<array<string, mixed>>
*/
private function createDiscounts(): array
{ $discounts =
[];
$count =
$this->faker->
randomDigit() / 3;
for ($i = 0;
$i <=
$count; ++
$i) { $scope =
$this->faker->
randomElement([PromotionDiscountEntity::SCOPE_CART, PromotionDiscountEntity::SCOPE_DELIVERY
]);
$type =
$this->faker->
randomElement([PromotionDiscountEntity::TYPE_ABSOLUTE, PromotionDiscountEntity::TYPE_PERCENTAGE
]);
$value =
$this->faker->
randomFloat(2, 0.01, 100
);
if ($type === PromotionDiscountEntity::TYPE_PERCENTAGE ||
$scope === PromotionDiscountEntity::SCOPE_DELIVERY
) { $value /= 10;
} $discounts[] =
[ 'scope' =>
$scope,
'type' =>
$type,
'value' =>
$value,
'considerAdvancedRules' => false,
];
}