Completed
Push — master ( 1f8bb9...0c53f4 )
by Phecho
06:42 queued 03:18
created

AddOwnerCommandHandler   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 24
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 24
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 14 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\Owner;
13
14
use Gitamin\Commands\Owner\AddOwnerCommand;
15
use Gitamin\Events\Owner\OwnerWasAddedEvent;
16
use Gitamin\Models\Owner;
17
18
class AddOwnerCommandHandler
19
{
20
    /**
21
     * Handle the add project owner command.
22
     *
23
     * @param \Gitamin\Commands\Owner\AddOwnerCommand $command
24
     *
25
     * @return \Gitamin\Models\Owner
26
     */
27
    public function handle(AddOwnerCommand $command)
28
    {
29
        $group = Owner::create([
30
            'name'        => $command->name,
31
            'path'        => $command->path,
32
            'user_id'     => $command->user_id,
33
            'description' => $command->description,
34
            'type'        => $command->type,
35
        ]);
36
37
        event(new OwnerWasAddedEvent($group));
38
39
        return $group;
40
    }
41
}
42