RemoveEndPoints::handle()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 13
rs 9.8333
c 0
b 0
f 0
cc 2
nc 2
nop 0
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