MobilyWsNotificationMakeCommand::fire()   A
last analyzed

Complexity

Conditions 3
Paths 2

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 12

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 0
cts 6
cp 0
rs 10
c 0
b 0
f 0
cc 3
nc 2
nop 0
crap 12
1
<?php
2
3
namespace NotificationChannels\MobilyWs\Console;
4
5
use Illuminate\Console\GeneratorCommand;
6
use Symfony\Component\Console\Input\InputOption;
7
8
class MobilyWsNotificationMakeCommand extends GeneratorCommand
9
{
10
    /**
11
     * The console command name.
12
     *
13
     * @var string
14
     */
15
    protected $name = 'mobilyws:notification';
16
17
    /**
18
     * The console command description.
19
     *
20
     * @var string
21
     */
22
    protected $description = 'Create a new Mobily.ws SMS notification class';
23
24
    /**
25
     * The type of class being generated.
26
     *
27
     * @var string
28
     */
29
    protected $type = 'Notification';
30
31
    /**
32
     * Execute the console command.
33
     *
34
     * @return void
35
     */
36
    public function fire()
37
    {
38
        if (parent::fire() === false && ! $this->option('force')) {
39
            return;
40
        }
41
    }
42
43
    /**
44
     * Build the class with the given name.
45
     *
46
     * @param  string  $name
47
     * @return string
48
     */
49
    protected function buildClass($name)
50
    {
51
        return parent::buildClass($name);
52
    }
53
54
    /**
55
     * Get the stub file for the generator.
56
     *
57
     * @return string
58
     */
59
    protected function getStub()
60
    {
61
        return __DIR__.'/stubs/notification.stub';
62
    }
63
64
    /**
65
     * Get the default namespace for the class.
66
     *
67
     * @param  string  $rootNamespace
68
     * @return string
69
     */
70
    protected function getDefaultNamespace($rootNamespace)
71
    {
72
        return $rootNamespace.'\Notifications';
73
    }
74
75
    /**
76
     * Get the console command options.
77
     *
78
     * @return array
79
     */
80
    protected function getOptions()
81
    {
82
        return [
83
            ['force', 'f', InputOption::VALUE_NONE, 'Create the class even if the notification already exists.'],
84
        ];
85
    }
86
}
87