Completed
Push — theme-bundle ( 1d6982...0052c5 )
by Kamil
20:08 queued 06:07
created

Theme::getCode()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file is part of the Sylius package.
5
 *
6
 * (c) Paweł Jędrzejewski
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 Sylius\Bundle\ThemeBundle\Model;
13
14
/**
15
 * @author Kamil Kokot <[email protected]>
16
 */
17
class Theme implements ThemeInterface
18
{
19
    /**
20
     * @var string
21
     */
22
    protected $name;
23
24
    /**
25
     * @var string
26
     */
27
    protected $slug;
28
29
    /**
30
     * @var string
31
     */
32
    protected $path;
33
34
    /**
35
     * @var string
36
     */
37
    protected $description;
38
39
    /**
40
     * @var array
41
     */
42
    protected $parentsSlugs;
43
44
    /**
45
     * @var string
46
     */
47
    protected $code;
48
49
    /**
50
     * {@inheritdoc}
51
     */
52
    public function getId()
53
    {
54
        return $this->getSlug();
55
    }
56
57
    /**
58
     * {@inheritdoc}
59
     */
60
    public function getName()
61
    {
62
        return $this->name;
63
    }
64
65
    /**
66
     * {@inheritdoc}
67
     */
68
    public function setName($name)
69
    {
70
        $this->name = $name;
71
    }
72
73
    /**
74
     * {@inheritdoc}
75
     */
76
    public function getSlug()
77
    {
78
        return $this->slug;
79
    }
80
81
    /**
82
     * {@inheritdoc}
83
     */
84
    public function setSlug($slug)
85
    {
86
        $this->slug = $slug;
87
        $this->code = substr(md5($slug), 0, 8);
88
    }
89
90
    /**
91
     * {@inheritdoc}
92
     */
93
    public function getPath()
94
    {
95
        return $this->path;
96
    }
97
98
    /**
99
     * {@inheritdoc}
100
     */
101
    public function setPath($path)
102
    {
103
        $this->path = $path;
104
    }
105
106
    /**
107
     * {@inheritdoc}
108
     */
109
    public function getDescription()
110
    {
111
        return $this->description;
112
    }
113
114
    /**
115
     * {@inheritdoc}
116
     */
117
    public function setDescription($description)
118
    {
119
        $this->description = $description;
120
    }
121
122
    /**
123
     * {@inheritdoc}
124
     */
125
    public function getParentsSlugs()
126
    {
127
        return $this->parentsSlugs;
128
    }
129
130
    /**
131
     * {@inheritdoc}
132
     */
133
    public function setParentsSlugs(array $parentsSlugs)
134
    {
135
        $this->parentsSlugs = $parentsSlugs;
136
    }
137
138
    /**
139
     * {@inheritdoc}
140
     */
141
    public function getCode()
142
    {
143
        return $this->code;
144
    }
145
}
146