Completed
Push — master ( b0764c...fc8584 )
by he
07:50
created

SolutionServer::send()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 2
eloc 5
c 1
b 0
f 1
nc 2
nop 0
dl 0
loc 8
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('judge.service.down')) {
23
            return;
24
        }
25
        $queue = app(TaskQueue::class);
26
        $queue->add($this->task);
27
        $queue->done();
28
    }
29
}