Completed
Push — master ( c675f1...96be6f )
by Hamoud
06:16 queued 10s
created

MobilyWsNotificationMakeCommand   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 79
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 7
c 1
b 0
f 0
lcom 0
cbo 1
dl 0
loc 79
ccs 0
cts 24
cp 0
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A fire() 0 6 3
A buildClass() 0 4 1
A getStub() 0 4 1
A getDefaultNamespace() 0 4 1
A getOptions() 0 6 1
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