SolutionServer   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 1
Metric Value
eloc 12
c 2
b 0
f 1
dl 0
loc 23
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A add() 0 9 1
A send() 0 8 2
1
<?php
2
3
namespace App\Task;
4
5
class SolutionServer
6
{
7
    private $task;
8
9
    public function add($solution)
10
    {
11
        $task = app(Task::class);
12
        $task->setSolution($solution);
13
        $task->setProblem($solution->problem);
14
15
        $this->task = $task;
16
17
        return $this;
18
    }
19
20
    public function send()
21
    {
22
        if (config('hustoj.services.judge.status') == false) {
23
            return;
24
        }
25
        $queue = app(TaskQueue::class);
26
        $queue->add($this->task);
27
        $queue->done();
28
    }
29
}
30