RemoveEndPoints   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 13 2
1
<?php
2
3
namespace Infinitypaul\LaravelUptime\Commands;
4
5
use Illuminate\Console\Command;
6
use Infinitypaul\LaravelUptime\Endpoint;
7
8
class RemoveEndPoints extends Command
9
{
10
    /**
11
     * The name and signature of the console command.
12
     *
13
     * @var string
14
     */
15
    protected $signature = 'endpoint:remove {id :  The Endpoint ID To Remove} ';
16
17
    /**
18
     * The console command description.
19
     *
20
     * @var string
21
     */
22
    protected $description = 'Remove Endpoint Command';
23
24
    /**
25
     * Execute the console command.
26
     *
27
     * @return mixed
28
     */
29
    public function handle()
30
    {
31
        $endpoint = Endpoint::find($id = $this->argument('id'));
32
        if (! $endpoint) {
33
            $this->error("Endpoint With ID {$id} Doesn't Exist ");
34
35
            return;
36
        }
37
38
        $endpoint->delete();
39
40
        $this->info("Endpoint With ID {$id} Has Been Deleted ");
41
    }
42
}
43