Passed
Push — master ( 49f1ef...b2146d )
by John
05:49 queued 11s
created

MonitorBase   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A updateStatus() 0 10 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
        $judgeServer=JudgeServerModel::find($jsid);
14
        if(is_null($judgeServer)){
15
            return false;
16
        }else{
17
            if($judgeServer->available==0){
18
                $status=-2;
19
            }
20
            $judgeServer->status=$status;
21
            $judgeServer->status_update_at=date("Y-m-d H:i:s");
22
        }
23
    }
24
}
25