Completed
Push — master ( c1cd82...4c112d )
by Gorka
03:17
created

CreateOrganizationCommand   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 6
lcom 0
cbo 1
dl 0
loc 42
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 14 2
A id() 0 4 1
A name() 0 4 1
A creatorId() 0 4 1
A slug() 0 4 1
1
<?php
2
3
/*
4
 * This file is part of the Kreta package.
5
 *
6
 * (c) Beñat Espiña <[email protected]>
7
 * (c) Gorka Laucirica <[email protected]>
8
 *
9
 * For the full copyright and license information, please view the LICENSE
10
 * file that was distributed with this source code.
11
 */
12
13
declare(strict_types=1);
14
15
namespace Kreta\TaskManager\Application\Organization;
16
17
use Kreta\SharedKernel\Domain\Model\InvalidArgumentException;
18
19
class CreateOrganizationCommand
20
{
21
    private $creatorId;
22
    private $name;
23
    private $id;
24
    private $slug;
25
26
    public function __construct(
27
        string $creatorId,
28
        string $name,
29
        string $id = null,
30
        string $slug = null
31
    ) {
32
        if ('' === $creatorId) {
33
            throw new InvalidArgumentException('User id cannot be null');
34
        }
35
        $this->id = $id;
36
        $this->creatorId = $creatorId;
37
        $this->name = $name;
38
        $this->slug = $slug;
39
    }
40
41
    public function id()
42
    {
43
        return $this->id;
44
    }
45
46
    public function name() : string
47
    {
48
        return $this->name;
49
    }
50
51
    public function creatorId(): string
52
    {
53
        return $this->creatorId;
54
    }
55
56
    public function slug()
57
    {
58
        return $this->slug;
59
    }
60
}
61