Completed
Push — master ( cfed93...a79400 )
by Phecho
03:52
created

AddProjectNamespaceCommandHandler   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 1
c 1
b 0
f 1
lcom 0
cbo 3
dl 0
loc 22
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 12 1
1
<?php
2
3
/*
4
 * This file is part of Gitamin.
5
 * 
6
 * Copyright (C) 2015-2016 The Gitamin Team
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Gitamin\Handlers\Commands\ProjectNamespace;
13
14
use Gitamin\Commands\ProjectNamespace\AddProjectNamespaceCommand;
15
use Gitamin\Events\ProjectNamespace\ProjectNamespaceWasAddedEvent;
16
use Gitamin\Models\ProjectNamespace;
17
18
class AddProjectNamespaceCommandHandler
19
{
20
    /**
21
     * Handle the add project team command.
22
     *
23
     * @param \Gitamin\Commands\ProjectTeam\AddProjectTeamCommand $command
24
     *
25
     * @return \Gitamin\Models\ProjectTeam
26
     */
27
    public function handle(AddProjectNamespaceCommand $command)
28
    {
29
        $group = ProjectNamespace::create([
30
            'name'  => $command->name,
31
            'path'  => $command->path,
32
            'type'  => $command->type,
33
        ]);
34
35
        event(new ProjectNamespaceWasAddedEvent($group));
36
37
        return $group;
38
    }
39
}
40