Media::getId()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
3
namespace MediaBundle\Model;
4
5
use Symfony\Component\HttpFoundation\File\File;
6
7
abstract class Media
0 ignored issues
show
Coding Style introduced by
Media does not seem to conform to the naming convention (^Abstract|Factory$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
8
{
9
10
    /**
11
     *
12
     * @var int
13
     */
14
    protected $id;
15
    
16
    /**
17
     *
18
     * @var File
19
     */
20
    protected $file;
21
    
22
    /**
23
     *
24
     * @var string
25
     */
26
    protected $filename;
27
    
28
    /**
29
     *
30
     * @var string
31
     */
32
    protected $format;
33
34
    /**
35
     *
36
     * @var array
37
     */
38
    protected $metadata;
39
40
    /**
41
     *
42
     * @var \DateTime
43
     */
44
    protected $updatedAt;
45
46
    /**
47
     *
48
     * @var \DateTime
49
     */
50
    protected $createdAt;
51
52
    /**
53
     * 
54
     * @return string
55
     */
56
    public function __toString()
57
    {
58
        return (string) $this->getFilename();
59
    }
60
    
61
    /**
62
     * 
63
     * @return int
64
     */
65
    public function getId()
66
    {
67
        return $this->id;
68
    }
69
    
70
    /**
71
     * 
72
     * @param File $file
73
     * 
74
     * @return $this
75
     */
76
    public function setFile(File $file)
77
    {
78
        $this->file = $file;
79
        
80
        return $this;
81
    }
82
    
83
    /**
84
     * 
85
     * @return File
86
     */
87
    public function getFile()
88
    {
89
        return $this->file;
90
    }
91
    
92
    public function preUpdate()
93
    {
94
        $this->updatedAt = new \DateTime();
95
    }
96
    
97
    public function prePersist()
98
    {
99
        $this->updatedAt = new \DateTime();
100
        $this->createdAt = new \DateTime();
101
    }
102
    
103
    /**
104
     * Set filename
105
     *
106
     * @param string $filename
107
     *
108
     * @return Media
109
     */
110
    public function setFilename($filename)
111
    {
112
        $this->filename = $filename;
113
114
        return $this;
115
    }
116
117
    /**
118
     * Get filename
119
     *
120
     * @return string
121
     */
122
    public function getFilename()
123
    {
124
        return $this->filename;
125
    }
126
127
    /**
128
     * Set format
129
     *
130
     * @param string $format
131
     *
132
     * @return Media
133
     */
134
    public function setFormat($format)
135
    {
136
        $this->format = $format;
137
138
        return $this;
139
    }
140
141
    /**
142
     * Get format
143
     *
144
     * @return string
145
     */
146
    public function getFormat()
147
    {
148
        return $this->format;
149
    }
150
151
    /**
152
     * Set metadata
153
     *
154
     * @param array $metadata
155
     *
156
     * @return Media
157
     */
158
    public function setMetadata($metadata)
159
    {
160
        $this->metadata = $metadata;
161
162
        return $this;
163
    }
164
165
    /**
166
     * Get metadata
167
     *
168
     * @return array
169
     */
170
    public function getMetadata()
171
    {
172
        return $this->metadata;
173
    }
174
175
    /**
176
     * Set updatedAt
177
     *
178
     * @param \DateTime $updatedAt
179
     *
180
     * @return Media
181
     */
182
    public function setUpdatedAt($updatedAt)
183
    {
184
        $this->updatedAt = $updatedAt;
185
186
        return $this;
187
    }
188
189
    /**
190
     * Get updatedAt
191
     *
192
     * @return \DateTime
193
     */
194
    public function getUpdatedAt()
195
    {
196
        return $this->updatedAt;
197
    }
198
199
    /**
200
     * Set createdAt
201
     *
202
     * @param \DateTime $createdAt
203
     *
204
     * @return Media
205
     */
206
    public function setCreatedAt($createdAt)
207
    {
208
        $this->createdAt = $createdAt;
209
210
        return $this;
211
    }
212
213
    /**
214
     * Get createdAt
215
     *
216
     * @return \DateTime
217
     */
218
    public function getCreatedAt()
219
    {
220
        return $this->createdAt;
221
    }
222
223
}
224