Completed
Push — master ( 838197...9b1ada )
by Beñat
03:21
created

ManageMenuCommand   A

Complexity

Total Complexity 9

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 9
lcom 0
cbo 3
dl 0
loc 51
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 17 4
A id() 0 4 1
A locale() 0 4 1
A code() 0 4 1
A name() 0 4 1
A items() 0 4 1
1
<?php
2
3
/*
4
 * This file is part of the CMS Kernel package.
5
 *
6
 * Copyright (c) 2016-present LIN3S <[email protected]>
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 LIN3S\CMSKernel\Application\Command\Menu;
13
14
use LIN3S\CMSKernel\Domain\Model\Menu\EmptyMenuCodeException;
15
use LIN3S\CMSKernel\Domain\Model\Menu\EmptyMenuNameException;
16
use LIN3S\SharedKernel\Exception\InvalidArgumentException;
17
18
/**
19
 * @author Beñat Espiña <[email protected]>
20
 */
21
class ManageMenuCommand
22
{
23
    private $menuId;
24
    private $code;
25
    private $locale;
26
    private $items;
27
    private $name;
28
29
    public function __construct($locale, $name, $code, array $items = [], $menuId = null)
30
    {
31
        if (null === $locale) {
32
            throw new InvalidArgumentException('The locale cannot be null');
33
        }
34
        if (empty($name)) {
35
            throw new EmptyMenuNameException();
36
        }
37
        if (empty($code)) {
38
            throw new EmptyMenuCodeException();
39
        }
40
        $this->menuId = $menuId;
41
        $this->locale = $locale;
42
        $this->code = $code;
43
        $this->name = $name;
44
        $this->items = $items;
45
    }
46
47
    public function id()
48
    {
49
        return $this->menuId;
50
    }
51
52
    public function locale()
53
    {
54
        return $this->locale;
55
    }
56
57
    public function code()
58
    {
59
        return $this->code;
60
    }
61
62
    public function name()
63
    {
64
        return $this->name;
65
    }
66
67
    public function items()
68
    {
69
        return $this->items;
70
    }
71
}
72