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

MonitorBase::updateStatus()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 10
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

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