Completed
Pull Request — master (#447)
by Alexandru
01:58
created

RestartServer::handle()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 11
rs 9.9
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace BeyondCode\LaravelWebSockets\Console\Commands;
4
5
use Illuminate\Console\Command;
6
use Illuminate\Support\Facades\Cache;
7
use Illuminate\Support\InteractsWithTime;
8
9
class RestartServer extends Command
10
{
11
    use InteractsWithTime;
12
13
    /**
14
     * The name and signature of the console command.
15
     *
16
     * @var string
17
     */
18
    protected $signature = 'websockets:restart';
19
20
    /**
21
     * The console command description.
22
     *
23
     * @var string|null
24
     */
25
    protected $description = 'Signal the WebSockets server to restart.';
26
27
    /**
28
     * Run the command.
29
     *
30
     * @return void
31
     */
32
    public function handle()
33
    {
34
        Cache::forever(
35
            'beyondcode:websockets:restart',
36
            $this->currentTime()
37
        );
38
39
        $this->info(
40
            'Broadcasted the restart signal to the WebSocket server!'
41
        );
42
    }
43
}
44