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

src/Console/Commands/GenerateTagGroup.php (1 issue)

Labels
Severity
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
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