odds_snapshot_json) ? $item->odds_snapshot_json : null; $lines = []; $total = 0; $bestTier = null; $bestRank = 99; foreach ($combinations as $c) { /** @var TicketCombination $c */ $hit = $board->bestSmallTierForNumber((string) $c->number_4d); if ($hit === null) { continue; } $tier = $hit['tier']; $oddsVal = $this->odds->oddsValueForScope($snapshot, $tier); $bet = (int) $c->bet_amount; $payout = (int) floor($bet * ($oddsVal / 10_000)); $total += $payout; $lines[] = [ 'number_4d' => $c->number_4d, 'matched_tier' => $tier, 'bet_amount' => $bet, 'odds_value' => $oddsVal, 'payout' => $payout, ]; if ($hit['rank'] < $bestRank) { $bestRank = $hit['rank']; $bestTier = $tier; } } return [ 'win_amount' => $total, 'matched_prize_tier' => $bestTier, 'match_detail' => ['lines' => $lines], ]; } }