Completed
Push — master ( 86bee8...f7a629 )
by Grégoire
04:38
created

Gallery::setCreatedAt()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
/*
4
 * This file is part of the Sonata Project package.
5
 *
6
 * (c) Thomas Rabaix <[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 Sonata\MediaBundle\Model;
13
14
use Doctrine\Common\Collections\ArrayCollection;
15
16
abstract class Gallery implements GalleryInterface
17
{
18
    /**
19
     * @var string
20
     */
21
    protected $context;
22
23
    /**
24
     * @var string
25
     */
26
    protected $name;
27
28
    /**
29
     * @var bool
30
     */
31
    protected $enabled;
32
33
    /**
34
     * @var \Datetime
35
     */
36
    protected $updatedAt;
37
38
    /**
39
     * @var \Datetime
40
     */
41
    protected $createdAt;
42
43
    /**
44
     * @var string
45
     */
46
    protected $defaultFormat;
47
48
    /**
49
     * @var GalleryItemInterface[]
50
     */
51
    protected $galleryItems;
52
53
    /**
54
     * {@inheritdoc}
55
     */
56
    public function __toString()
57
    {
58
        return $this->getName() ?: '-';
59
    }
60
61
    /**
62
     * {@inheritdoc}
63
     */
64
    public function setName($name)
65
    {
66
        $this->name = $name;
67
    }
68
69
    /**
70
     * {@inheritdoc}
71
     */
72
    public function getName()
73
    {
74
        return $this->name;
75
    }
76
77
    /**
78
     * {@inheritdoc}
79
     */
80
    public function setEnabled($enabled)
81
    {
82
        $this->enabled = $enabled;
83
    }
84
85
    /**
86
     * {@inheritdoc}
87
     */
88
    public function getEnabled()
89
    {
90
        return $this->enabled;
91
    }
92
93
    /**
94
     * {@inheritdoc}
95
     */
96
    public function setUpdatedAt(\DateTime $updatedAt = null)
97
    {
98
        $this->updatedAt = $updatedAt;
99
    }
100
101
    /**
102
     * {@inheritdoc}
103
     */
104
    public function getUpdatedAt()
105
    {
106
        return $this->updatedAt;
107
    }
108
109
    /**
110
     * {@inheritdoc}
111
     */
112
    public function setCreatedAt(\DateTime $createdAt = null)
113
    {
114
        $this->createdAt = $createdAt;
115
    }
116
117
    /**
118
     * {@inheritdoc}
119
     */
120
    public function getCreatedAt()
121
    {
122
        return $this->createdAt;
123
    }
124
125
    /**
126
     * {@inheritdoc}
127
     */
128
    public function setDefaultFormat($defaultFormat)
129
    {
130
        $this->defaultFormat = $defaultFormat;
131
    }
132
133
    /**
134
     * {@inheritdoc}
135
     */
136
    public function getDefaultFormat()
137
    {
138
        return $this->defaultFormat;
139
    }
140
141
    /**
142
     * {@inheritdoc}
143
     */
144
    public function setGalleryItems($galleryItems)
145
    {
146
        $this->galleryItems = new ArrayCollection();
0 ignored issues
show
Documentation Bug introduced by
It seems like new \Doctrine\Common\Collections\ArrayCollection() of type object<Doctrine\Common\C...ctions\ArrayCollection> is incompatible with the declared type array<integer,object<Son...\GalleryItemInterface>> of property $galleryItems.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
147
148
        foreach ($galleryItems as $galleryItem) {
149
            $this->addGalleryItem($galleryItem);
150
        }
151
    }
152
153
    /**
154
     * {@inheritdoc}
155
     */
156
    public function getGalleryItems()
157
    {
158
        return $this->galleryItems;
159
    }
160
161
    /**
162
     * {@inheritdoc}
163
     */
164
    public function addGalleryItem(GalleryItemInterface $galleryItem)
165
    {
166
        $galleryItem->setGallery($this);
167
168
        $this->galleryItems[] = $galleryItem;
169
    }
170
171
    /**
172
     * {@inheritdoc}
173
     */
174
    public function setContext($context)
175
    {
176
        $this->context = $context;
177
    }
178
179
    /**
180
     * {@inheritdoc}
181
     */
182
    public function getContext()
183
    {
184
        return $this->context;
185
    }
186
}
187