Passed
Pull Request — master (#610)
by John
05:33
created

Judge::handle()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 8
nc 2
nop 0
dl 0
loc 10
rs 10
c 1
b 0
f 0
1
<?php
2
3
namespace App\Console\Commands\Babel;
4
5
use Illuminate\Console\Command;
6
use App\Babel\Babel;
7
use Exception;
8
9
class Judge extends Command
10
{
11
    /**
12
     * The name and signature of the console command.
13
     *
14
     * @var string
15
     */
16
    protected $signature='babel:judge';
17
18
    /**
19
     * The console command description.
20
     *
21
     * @var string
22
     */
23
    protected $description='Synchronize remote verdict for all Babel Extensions of NOJ';
24
25
    /**
26
     * Create a new command instance.
27
     *
28
     * @return void
29
     */
30
    public function __construct()
31
    {
32
        parent::__construct();
33
    }
34
35
    /**
36
     * Execute the console command.
37
     *
38
     * @return mixed
39
     */
40
    public function handle()
41
    {
42
        $babel=new Babel();
43
        while (true) {
44
            $time=date("Y-m-d H:i:s");
45
            $this->line("<fg=yellow>[$time] Processing:  </>NOJ Babel Judge Sync");
46
            $babel->judge();
47
            $time=date("Y-m-d H:i:s");
48
            $this->line("<fg=green>[$time] Processed:   </>NOJ Babel Judge Sync");
49
            sleep(5);
50
        }
51
    }
52
}
53