Completed
Push — master ( 9abbc7...a687e5 )
by Fabrizio
03:03
created

CreateGroup::getArguments()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 1 Features 1
Metric Value
c 2
b 1
f 1
dl 0
loc 6
rs 9.4285
cc 1
eloc 3
nc 1
nop 0
1
<?php
2
3
namespace Fenos\Notifynder\Artisan;
4
5
use Fenos\Notifynder\Contracts\NotifynderGroup;
6
use Illuminate\Console\Command;
7
use Symfony\Component\Console\Input\InputArgument;
8
9
class CreateGroup extends Command
10
{
11
    /**
12
     * The console command name.
13
     *
14
     * @var string
15
     */
16
    protected $name = 'notifynder:create:group';
17
18
    /**
19
     * The console command description.
20
     *
21
     * @var string
22
     */
23
    protected $description = 'Store a new notifynder group in the DB.';
24
25
    /**
26
     * @var NotifynderGroup
27
     */
28
    private $notifynderGroup;
29
30
    /**
31
     * Create a new command instance.
32
     *
33
     * @param  NotifynderGroup                    $notifynderGroup
34
     * @return \Fenos\Notifynder\Artisan\CreateGroup
0 ignored issues
show
Comprehensibility Best Practice introduced by
Adding a @return annotation to constructors is generally not recommended as a constructor does not have a meaningful return value.

Adding a @return annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.

Please refer to the PHP core documentation on constructors.

Loading history...
35
     */
36
    public function __construct(NotifynderGroup $notifynderGroup)
37
    {
38
        parent::__construct();
39
        $this->notifynderGroup = $notifynderGroup;
40
    }
41
42
    /**
43
     * Execute the console command.
44
     *
45
     * @return mixed
46
     */
47
    public function fire()
48
    {
49
        $nameGroup = $this->argument('name');
50
51
        if (! $this->notifynderGroup->addGroup($nameGroup)) {
52
            $this->error('The name must be a string with dots as namespaces');
53
54
            return false;
55
        }
56
        $this->info("Group {$nameGroup} has Been created");
57
    }
58
59
    /**
60
     * Get the console command arguments.
61
     *
62
     * @return array
63
     */
64
    protected function getArguments()
65
    {
66
        return [
67
            ['name', InputArgument::REQUIRED, 'user.post.add'],
68
        ];
69
    }
70
}
71