| Total Complexity | 8 |
| Total Lines | 64 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 8 | class SummaryService |
||
| 9 | { |
||
| 10 | public static $statusTypes = [ |
||
| 11 | Status::ACCEPT, |
||
| 12 | Status::PRESENTATION_ERROR, |
||
| 13 | Status::WRONG_ANSWER, |
||
| 14 | Status::TIME_LIMIT, |
||
| 15 | Status::MEMORY_LIMIT, |
||
| 16 | Status::OUTPUT_LIMIT, |
||
| 17 | Status::RUNTIME_ERROR, |
||
| 18 | Status::COMPILE_ERROR, |
||
| 19 | ]; |
||
| 20 | public $acceptedUser = 0; |
||
| 21 | public $submitUser = 0; |
||
| 22 | public $total = 0; |
||
| 23 | public $statistics; |
||
| 24 | private $problem; |
||
| 25 | |||
| 26 | public function __construct(Problem $problem) |
||
| 27 | { |
||
| 28 | $this->problem = $problem; |
||
| 29 | |||
| 30 | $this->process(); |
||
| 31 | } |
||
| 32 | |||
| 33 | private function process() |
||
| 34 | { |
||
| 35 | $service = new ProblemService(); |
||
| 36 | |||
| 37 | $this->statistics = []; |
||
| 38 | $resultCount = $service->getResultCount($this->problem->id); |
||
| 39 | foreach ($resultCount as $result) { |
||
| 40 | $this->statistics[$result->result] = $result->user_count; |
||
| 41 | $this->total += $result->user_count; |
||
| 42 | } |
||
| 43 | } |
||
| 44 | |||
| 45 | public function getProblem() |
||
| 46 | { |
||
| 47 | return $this->problem; |
||
| 48 | } |
||
| 49 | |||
| 50 | public function accepted() |
||
| 55 | } |
||
| 56 | |||
| 57 | public function submit() |
||
| 58 | { |
||
| 59 | $service = new ProblemService(); |
||
| 60 | |||
| 61 | return $service->numberOfSubmitUser($this->problem->id); |
||
| 62 | } |
||
| 63 | |||
| 64 | public function getResultCount() |
||
| 67 | } |
||
| 68 | |||
| 69 | public function bestSolutions() |
||
| 72 | } |
||
| 73 | } |
||
| 74 |