public function pot() { $content = Pot::generate(); if (empty($content)) { throw new Exception('INTERNAL ERROR', 500); } header("Content-Disposition: attachment; filename=" . C::g('LANG_DOMAIN_CURRENT') . ".pot"); header("Content-Type: application/force-download"); print $content; }
/** * @param mixed $x * @throws \Error|\Exception|Pot * @sig $x -!-> $x|Pot($x) * An adapter to throw anything, not just exceptions. It is an identiy on \Throwables */ function toss($x) { throw !($x instanceof \Exception || $x instanceof \Error) ? Pot::of($x) : $x; }
/** * @param $data * @return Pot */ function Pot($data) { return Pot::of($data); }
function potAdd($seat, $bet) { $this->responses[$seat->num] = $bet; foreach ($this->pots as $pi => $pot) { if ($bet <= 0) { break; } # nothing to do if ($pot->isOpen()) { if ($pot->limit === NO_LIMIT) { $pot->add($seat->num, $bet); $bet = 0; break; } else { $deficit = $pot->getDeficit($seat); if ($deficit) { $bet -= $deficit; $pot->add($seat->num, $deficit); } } } } # left over cash! if ($bet > 0) { $pot = new Pot(); $this->pots[] = $pot; $pot->add($seat->num, $bet); } }