Files
lotteryLaravel/app/Services/Settlement/SettlementMatcherRegistry.php
kang cbb18b976f
Some checks failed
lotterLaravel CI / test (push) Has been cancelled
lotterLaravel E2E / e2e-api (push) Has been cancelled
feat(lottery): 扩展传统马来赔率、玩法结算与开注商短码支持
2026-07-10 17:04:28 +08:00

55 lines
2.7 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
namespace App\Services\Settlement;
use App\Services\Settlement\Matchers\NoopSettlementMatcher;
use App\Services\Settlement\Contracts\SettlementPlayMatcher;
use App\Services\Settlement\Matchers\Pos2AbcSettlementMatcher;
use App\Services\Settlement\Matchers\Pos3AbcSettlementMatcher;
use App\Services\Settlement\Matchers\Pos2TierSettlementMatcher;
use App\Services\Settlement\Matchers\Pos3TierSettlementMatcher;
use App\Services\Settlement\Matchers\BigSpreadSettlementMatcher;
use App\Services\Settlement\Matchers\SmallSpreadSettlementMatcher;
use App\Services\Settlement\Matchers\Pos4ListTierSettlementMatcher;
use App\Services\Settlement\Matchers\StraightLikeSettlementMatcher;
use App\Services\Settlement\Matchers\Pos4ExactTierSettlementMatcher;
use App\Services\Settlement\Matchers\FirstPrizeComboSettlementMatcher;
use App\Services\Settlement\Matchers\ScopeFilteredSettlementMatcher;
final class SettlementMatcherRegistry
{
public function __construct(
private readonly StraightLikeSettlementMatcher $straight,
private readonly BigSpreadSettlementMatcher $big,
private readonly SmallSpreadSettlementMatcher $small,
private readonly Pos4ExactTierSettlementMatcher $pos4Exact,
private readonly Pos4ListTierSettlementMatcher $pos4List,
private readonly Pos3TierSettlementMatcher $pos3Tier,
private readonly Pos3AbcSettlementMatcher $pos3Abc,
private readonly Pos2TierSettlementMatcher $pos2Tier,
private readonly Pos2AbcSettlementMatcher $pos2Abc,
private readonly FirstPrizeComboSettlementMatcher $firstPrizeCombo,
private readonly ScopeFilteredSettlementMatcher $scopeFiltered,
private readonly NoopSettlementMatcher $noop,
) {}
public function for(string $playCode): SettlementPlayMatcher
{
// half_boxPRD 一期预留;结算按已落库组合逐条取 23 档最优档,与 big/box 家族一致§5.6.6)。
return match ($playCode) {
'straight', 'roll' => $this->straight,
'big', 'ibox', 'mbox', 'box', 'half_box', 'four_any' => $this->big,
'small', 'four_top' => $this->small,
'pos_4a', 'pos_4b', 'pos_4c' => $this->pos4Exact,
'pos_4d', 'pos_4e' => $this->pos4List,
'pos_3a', 'pos_3b', 'pos_3c', 'pos_3d', 'pos_3e' => $this->pos3Tier,
'pos_3abc' => $this->pos3Abc,
'pos_2a', 'pos_2b', 'pos_2c', 'pos_2d', 'pos_2e' => $this->pos2Tier,
'pos_2abc' => $this->pos2Abc,
'four_lower', 'pos_3lower', 'pos_2any' => $this->scopeFiltered,
'head', 'tail', 'odd', 'even', 'digit_big', 'digit_small' => $this->firstPrizeCombo,
default => $this->noop,
};
}
}