Passed
Push — laravel-5 ( 7195ea...66f120 )
by Robert
02:51
created

GenerateTagGroup::getArguments()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 4
rs 10
1
<?php
2
3
namespace Conner\Tagging\Console\Commands;
4
5
use Conner\Tagging\TaggingUtility;
6
use Conner\Tagging\Model\TagGroup;
7
use Illuminate\Console\Command;
8
use Symfony\Component\Console\Input\InputArgument;
9
10
class GenerateTagGroup extends Command
11
{
12
    protected $name = 'tagging:create-group';
13
14
    protected $signature = 'tagging:create-group {group}';
15
16
    protected $description = 'Create a laravel tag group';
17
18
    public function handle()
19
    {
20
        $groupName = $this->argument('group');
21
22
        $tagGroup = new TagGroup();
23
        $tagGroup->name = $groupName;
24
        $tagGroup->slug = TaggingUtility::normalize($groupName);
25
26
        $tagGroup->save();
27
28
        $this->info('Created tag group: '.$groupName);
0 ignored issues
show
Bug introduced by Robert Conner
Are you sure $groupName of type null|string|string[] can be used in concatenation? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

28
        $this->info('Created tag group: './** @scrutinizer ignore-type */ $groupName);
Loading history...
29
    }
30
31
    protected function getArguments()
32
    {
33
        return [
34
            ['group', InputArgument::REQUIRED, 'Name of the group to create.'],
35
        ];
36
    }
37
}
38