Completed
Pull Request — master (#90)
by
unknown
01:41
created

AppCreate   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 1
dl 0
loc 37
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 30 2
1
<?php
2
3
namespace BeyondCode\LaravelWebSockets\Database\Console;
4
5
use Illuminate\Console\Command;
6
use BeyondCode\LaravelWebSockets\Database\Models\App;
7
8
class AppCreate extends Command
9
{
10
    protected $signature = 'websockets:app:create';
11
12
    protected $description = 'Create an app and save it on database.';
13
14
    public function handle()
15
    {
16
        $name = $this->ask('What is the app name? (required)');
17
18
        if (empty($name)) {
19
            $this->handle();
20
21
            return;
22
        }
23
24
        $host = $this->ask('Host: ');
25
26
        $enable_client_messages = $this->confirm('Would you enable client messages?');
27
28
        $enable_statistics = $this->confirm('Would you enable statistics?');
29
30
        $this->comment('Creating your application, please wait...');
31
32
        $app = App::create([
0 ignored issues
show
Bug introduced by
The method create() does not exist on BeyondCode\LaravelWebSockets\Database\Models\App. Did you maybe mean created()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
33
            'name' => $name,
34
            'host' => $host,
35
            'enable_client_messages' => $enable_client_messages,
36
            'enable_statistics' => $enable_statistics,
37
        ]);
38
39
        $this->info('Key: '.$app->key);
40
        $this->info('Secret: '.$app->secret);
41
42
        $this->comment('App has been created. Please save key and secret.');
43
    }
44
}
45