Completed
Push — master ( bb5318...2e968e )
by Bukashk0zzz
01:11
created

Category::getAttributes()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file is part of the Bukashk0zzzYmlGenerator
5
 *
6
 * (c) Denis Golubovskiy <[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 Bukashk0zzz\YmlGenerator\Model;
13
14
/**
15
 * Class Category
16
 */
17
class Category
18
{
19
    /**
20
     * @var int
21
     */
22
    private $id;
23
24
    /**
25
     * @var int
26
     */
27
    private $parentId;
28
29
    /**
30
     * @var string
31
     */
32
    private $name;
33
34
    /**
35
     * @var array
36
     */
37
    private $attributes = [];
38
39
    /**
40
     * @return int
41
     */
42
    public function getId()
43
    {
44
        return $this->id;
45
    }
46
47
    /**
48
     * @param int $id
49
     *
50
     * @return Category
51
     */
52
    public function setId($id)
53
    {
54
        $this->id = $id;
55
56
        return $this;
57
    }
58
59
    /**
60
     * @return int
61
     */
62
    public function getParentId()
63
    {
64
        return $this->parentId;
65
    }
66
67
    /**
68
     * @param int $parentId
69
     *
70
     * @return Category
71
     */
72
    public function setParentId($parentId)
73
    {
74
        $this->parentId = $parentId;
75
76
        return $this;
77
    }
78
79
    /**
80
     * @return string
81
     */
82
    public function getName()
83
    {
84
        return $this->name;
85
    }
86
87
    /**
88
     * @param string $name
89
     *
90
     * @return Category
91
     */
92
    public function setName($name)
93
    {
94
        $this->name = $name;
95
96
        return $this;
97
    }
98
99
    /**
100
     * @return array
101
     */
102
    public function getAttributes()
103
    {
104
        return $this->attributes;
105
    }
106
107
    /**
108
     * Sets list of custom attributes (Array of arrays [['name' => ?, 'value' => ?]])
109
     *
110
     * @param array $attributes
111
     *
112
     * @return Category
113
     */
114
    public function setAttributes(array $attributes)
115
    {
116
        $this->attributes = $attributes;
117
118
        return $this;
119
    }
120
121
    /**
122
     * @param string $attributeName
123
     * @param mixed $value
124
     *
125
     * @return Category
126
     */
127
    public function pushAttribute(string $attributeName, $value)
128
    {
129
        array_push($this->attributes, ['name' => $attributeName, 'value' => $value]);
130
131
        return $this;
132
    }
133
}
134