firstPrizeNumber4d(); if ($target === '') { return ['win_amount' => 0, 'matched_prize_tier' => null, 'match_detail' => ['reason' => 'no_first_prize']]; } $snapshot = is_array($item->odds_snapshot_json) ? $item->odds_snapshot_json : null; $oddsVal = $this->odds->oddsValueForScope($snapshot, 'first'); $lines = []; $total = 0; foreach ($combinations as $c) { /** @var TicketCombination $c */ if ((string) $c->number_4d !== $target) { continue; } $bet = (int) $c->bet_amount; $payout = (int) floor($bet * ($oddsVal / 10_000)); $total += $payout; $lines[] = [ 'number_4d' => $c->number_4d, 'bet_amount' => $bet, 'odds_value' => $oddsVal, 'payout' => $payout, ]; } return [ 'win_amount' => $total, 'matched_prize_tier' => $total > 0 ? 'first' : null, 'match_detail' => ['lines' => $lines, 'first_prize' => $target], ]; } }