Blame view
app/Queries/Predictor/Round.php
1.13 KB
e77200db5 Initial commit |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
<?php namespace FootyRoom\Queries\Predictor; use DateTime; use FootyRoom\Queries\Predictor\Summary; class Round { /** @var string */ public $id; /** @var string */ public $name; /** @var int */ public $matchCount = 0; /** @var int */ public $playerCount = 0; /** @var int */ public $maxProfit; /** @var int */ public $maxProfitUserId; /** @var int */ public $stake = 0; /** @var string One of: 'finished', 'current', 'upcoming'. */ public $status; /** @var \FootyRoom\Queries\Predictor\Summary */ public $player; public function getStartTimestamp(): int { return strtotime($this->id); } public function getEndTimestamp(): int { // Round ends exactly one week after the start. return $this->getStartTimestamp() + 604800; } public function forResponse($isPlayerRequired = false): array { if ($isPlayerRequired) { $this->player = $this->player ?? new Summary(); } $data = (array) $this; $data['startTimestamp'] = $this->getStartTimestamp(); return $data; } } |