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

AddProjectNamespaceCommandHandler::handle()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 12
rs 9.4286
cc 1
eloc 7
nc 1
nop 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