Completed
Push — master ( 481865...ed4291 )
by John
24s queued 10s
created

MonitorBase   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 9
c 1
b 0
f 1
dl 0
loc 13
rs 10
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A updateStatus() 0 11 3
1
<?php
2
3
namespace App\Babel\Monit;
4
5
use App\Models\Eloquent\JudgeServerModel;
6
use ErrorException;
7
use Exception;
8
use Throwable;
9
10
class MonitorBase
11
{
12
    public function updateStatus($jsid, $status)
13
    {
14
        $judgeServer=JudgeServerModel::find($jsid);
15
        if (is_null($judgeServer)) {
16
            return false;
17
        } else {
18
            if ($judgeServer->available==0) {
19
                $status=-2;
20
            }
21
            $judgeServer->status=$status;
22
            $judgeServer->status_update_at=date("Y-m-d H:i:s");
23
        }
24
    }
25
}
26