SolutionServer::add()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 5
c 1
b 0
f 1
nc 1
nop 1
dl 0
loc 9
rs 10
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