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

ManageMenuCommand::code()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
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