Completed
Pull Request — master (#447)
by Marcel
02:47 queued 01:22
created

RestartServer   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 3
dl 0
loc 35
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 11 1
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