1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Exif: A container class for EXIF data |
4
|
|
|
* |
5
|
|
|
* @link http://github.com/PHPExif/php-exif-common for the canonical source repository |
6
|
|
|
* @copyright Copyright (c) 2016 Tom Van Herreweghe <[email protected]> |
7
|
|
|
* @license http://github.com/PHPExif/php-exif-common/blob/master/LICENSE MIT License |
8
|
|
|
* @category PHPExif |
9
|
|
|
* @package Common |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace PHPExif\Common\Data; |
13
|
|
|
|
14
|
|
|
use PHPExif\Common\Data\ValueObject\Aperture; |
15
|
|
|
use PHPExif\Common\Data\ValueObject\Author; |
16
|
|
|
use PHPExif\Common\Data\ValueObject\Dimensions; |
17
|
|
|
use PHPExif\Common\Data\ValueObject\ExposureTime; |
18
|
|
|
use PHPExif\Common\Data\ValueObject\Filename; |
19
|
|
|
use PHPExif\Common\Data\ValueObject\Filesize; |
20
|
|
|
use PHPExif\Common\Data\ValueObject\FocalLength; |
21
|
|
|
use PHPExif\Common\Data\ValueObject\FocusDistance; |
22
|
|
|
use PHPExif\Common\Data\ValueObject\IsoSpeed; |
23
|
|
|
use PHPExif\Common\Data\ValueObject\LineResolution; |
24
|
|
|
use PHPExif\Common\Data\ValueObject\Make; |
25
|
|
|
use PHPExif\Common\Data\ValueObject\MimeType; |
26
|
|
|
use PHPExif\Common\Data\ValueObject\Model; |
27
|
|
|
use PHPExif\Common\Data\ValueObject\Resolution; |
28
|
|
|
use PHPExif\Common\Data\ValueObject\Software; |
29
|
|
|
use \DateTimeImmutable; |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* Exif class |
33
|
|
|
* |
34
|
|
|
* Container for EXIF data |
35
|
|
|
* |
36
|
|
|
* @category PHPExif |
37
|
|
|
* @package Common |
38
|
|
|
*/ |
39
|
|
|
class Exif implements ExifInterface |
40
|
|
|
{ |
41
|
|
|
/** |
42
|
|
|
* @var Aperture |
43
|
|
|
*/ |
44
|
|
|
protected $aperture; |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* @var Author |
48
|
|
|
*/ |
49
|
|
|
protected $author; |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* @var DateTimeImmutable |
53
|
|
|
*/ |
54
|
|
|
protected $creationDate; |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* @var Dimensions |
58
|
|
|
*/ |
59
|
|
|
protected $dimensions; |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* @var ExposureTime |
63
|
|
|
*/ |
64
|
|
|
protected $exposureTime; |
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* @var Filename |
68
|
|
|
*/ |
69
|
|
|
protected $filename; |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* @var Filesize |
73
|
|
|
*/ |
74
|
|
|
protected $filesize; |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* @var FocalLength |
78
|
|
|
*/ |
79
|
|
|
protected $focalLength; |
80
|
|
|
|
81
|
|
|
/** |
82
|
|
|
* @var FocusDistance |
83
|
|
|
*/ |
84
|
|
|
protected $focusDistance; |
85
|
|
|
|
86
|
|
|
/** |
87
|
|
|
* @var IsoSpeed |
88
|
|
|
*/ |
89
|
|
|
protected $isoSpeed; |
90
|
|
|
|
91
|
|
|
/** |
92
|
|
|
* @var Make |
93
|
|
|
*/ |
94
|
|
|
protected $make; |
95
|
|
|
|
96
|
|
|
/** |
97
|
|
|
* @var Model |
98
|
|
|
*/ |
99
|
|
|
protected $model; |
100
|
|
|
|
101
|
|
|
/** |
102
|
|
|
* @var MimeType |
103
|
|
|
*/ |
104
|
|
|
protected $mimeType; |
105
|
|
|
|
106
|
|
|
/** |
107
|
|
|
* @var Resolution |
108
|
|
|
*/ |
109
|
|
|
protected $resolution; |
110
|
|
|
|
111
|
|
|
/** |
112
|
|
|
* @var Software |
113
|
|
|
*/ |
114
|
|
|
protected $software; |
115
|
|
|
|
116
|
|
|
/** |
117
|
|
|
* {@inheritDoc} |
118
|
|
|
*/ |
119
|
|
|
public function getAperture() |
120
|
|
|
{ |
121
|
|
|
return $this->aperture; |
122
|
|
|
} |
123
|
|
|
|
124
|
|
|
/** |
125
|
|
|
* {@inheritDoc} |
126
|
|
|
*/ |
127
|
|
|
public function withAperture(Aperture $aperture) |
128
|
|
|
{ |
129
|
|
|
$new = clone $this; |
130
|
|
|
$new->aperture = $aperture; |
131
|
|
|
|
132
|
|
|
return $new; |
133
|
|
|
} |
134
|
|
|
|
135
|
|
|
/** |
136
|
|
|
* {@inheritDoc} |
137
|
|
|
*/ |
138
|
|
|
public function getMimeType() |
139
|
|
|
{ |
140
|
|
|
return $this->mimeType; |
141
|
|
|
} |
142
|
|
|
|
143
|
|
|
/** |
144
|
|
|
* {@inheritDoc} |
145
|
|
|
*/ |
146
|
|
|
public function withMimeType(MimeType $mimeType) |
147
|
|
|
{ |
148
|
|
|
$new = clone $this; |
149
|
|
|
$new->mimeType = $mimeType; |
150
|
|
|
|
151
|
|
|
return $new; |
152
|
|
|
} |
153
|
|
|
|
154
|
|
|
/** |
155
|
|
|
* {@inheritDoc} |
156
|
|
|
*/ |
157
|
|
|
public function getFilename() |
158
|
|
|
{ |
159
|
|
|
return $this->filename; |
160
|
|
|
} |
161
|
|
|
|
162
|
|
|
/** |
163
|
|
|
* {@inheritDoc} |
164
|
|
|
*/ |
165
|
|
|
public function withFilename(Filename $filename) |
166
|
|
|
{ |
167
|
|
|
$new = clone $this; |
168
|
|
|
$new->filename = $filename; |
169
|
|
|
|
170
|
|
|
return $new; |
171
|
|
|
} |
172
|
|
|
|
173
|
|
|
/** |
174
|
|
|
* {@inheritDoc} |
175
|
|
|
*/ |
176
|
|
|
public function getFilesize() |
177
|
|
|
{ |
178
|
|
|
return $this->filesize; |
179
|
|
|
} |
180
|
|
|
|
181
|
|
|
/** |
182
|
|
|
* {@inheritDoc} |
183
|
|
|
*/ |
184
|
|
|
public function withFilesize(Filesize $filesize) |
185
|
|
|
{ |
186
|
|
|
$new = clone $this; |
187
|
|
|
$new->filesize = $filesize; |
188
|
|
|
|
189
|
|
|
return $new; |
190
|
|
|
} |
191
|
|
|
|
192
|
|
|
/** |
193
|
|
|
* {@inheritDoc} |
194
|
|
|
*/ |
195
|
|
|
public function getMake() |
196
|
|
|
{ |
197
|
|
|
return $this->make; |
198
|
|
|
} |
199
|
|
|
|
200
|
|
|
/** |
201
|
|
|
* {@inheritDoc} |
202
|
|
|
*/ |
203
|
|
|
public function withMake(Make $make) |
204
|
|
|
{ |
205
|
|
|
$new = clone $this; |
206
|
|
|
$new->make = $make; |
207
|
|
|
|
208
|
|
|
return $new; |
209
|
|
|
} |
210
|
|
|
|
211
|
|
|
/** |
212
|
|
|
* {@inheritDoc} |
213
|
|
|
*/ |
214
|
|
|
public function getModel() |
215
|
|
|
{ |
216
|
|
|
return $this->model; |
217
|
|
|
} |
218
|
|
|
|
219
|
|
|
/** |
220
|
|
|
* {@inheritDoc} |
221
|
|
|
*/ |
222
|
|
|
public function withModel(Model $model) |
223
|
|
|
{ |
224
|
|
|
$new = clone $this; |
225
|
|
|
$new->model = $model; |
226
|
|
|
|
227
|
|
|
return $new; |
228
|
|
|
} |
229
|
|
|
|
230
|
|
|
/** |
231
|
|
|
* {@inheritDoc} |
232
|
|
|
*/ |
233
|
|
|
public function getSoftware() |
234
|
|
|
{ |
235
|
|
|
return $this->software; |
236
|
|
|
} |
237
|
|
|
|
238
|
|
|
/** |
239
|
|
|
* {@inheritDoc} |
240
|
|
|
*/ |
241
|
|
|
public function withSoftware(Software $software) |
242
|
|
|
{ |
243
|
|
|
$new = clone $this; |
244
|
|
|
$new->software = $software; |
245
|
|
|
|
246
|
|
|
return $new; |
247
|
|
|
} |
248
|
|
|
|
249
|
|
|
/** |
250
|
|
|
* {@inheritDoc} |
251
|
|
|
*/ |
252
|
|
|
public function getAuthor() |
253
|
|
|
{ |
254
|
|
|
return $this->author; |
255
|
|
|
} |
256
|
|
|
|
257
|
|
|
/** |
258
|
|
|
* {@inheritDoc} |
259
|
|
|
*/ |
260
|
|
|
public function withAuthor(Author $author) |
261
|
|
|
{ |
262
|
|
|
$new = clone $this; |
263
|
|
|
$new->author = $author; |
264
|
|
|
|
265
|
|
|
return $new; |
266
|
|
|
} |
267
|
|
|
|
268
|
|
|
/** |
269
|
|
|
* {@inheritDoc} |
270
|
|
|
*/ |
271
|
|
|
public function getDimensions() |
272
|
|
|
{ |
273
|
|
|
return $this->dimensions; |
274
|
|
|
} |
275
|
|
|
|
276
|
|
|
/** |
277
|
|
|
* {@inheritDoc} |
278
|
|
|
*/ |
279
|
|
|
public function withDimensions(Dimensions $dimensions) |
280
|
|
|
{ |
281
|
|
|
$new = clone $this; |
282
|
|
|
$new->dimensions = $dimensions; |
283
|
|
|
|
284
|
|
|
return $new; |
285
|
|
|
} |
286
|
|
|
|
287
|
|
|
/** |
288
|
|
|
* {@inheritDoc} |
289
|
|
|
*/ |
290
|
|
|
public function getFocalLength() |
291
|
|
|
{ |
292
|
|
|
return $this->focalLength; |
293
|
|
|
} |
294
|
|
|
|
295
|
|
|
/** |
296
|
|
|
* {@inheritDoc} |
297
|
|
|
*/ |
298
|
|
|
public function withFocalLength(FocalLength $focalLength) |
299
|
|
|
{ |
300
|
|
|
$new = clone $this; |
301
|
|
|
$new->focalLength = $focalLength; |
302
|
|
|
|
303
|
|
|
return $new; |
304
|
|
|
} |
305
|
|
|
|
306
|
|
|
/** |
307
|
|
|
* {@inheritDoc} |
308
|
|
|
*/ |
309
|
|
|
public function getFocusDistance() |
310
|
|
|
{ |
311
|
|
|
return $this->focusDistance; |
312
|
|
|
} |
313
|
|
|
|
314
|
|
|
/** |
315
|
|
|
* {@inheritDoc} |
316
|
|
|
*/ |
317
|
|
|
public function withFocusDistance(FocusDistance $focusDistance) |
318
|
|
|
{ |
319
|
|
|
$new = clone $this; |
320
|
|
|
$new->focusDistance = $focusDistance; |
321
|
|
|
|
322
|
|
|
return $new; |
323
|
|
|
} |
324
|
|
|
|
325
|
|
|
/** |
326
|
|
|
* {@inheritDoc} |
327
|
|
|
*/ |
328
|
|
|
public function getExposureTime() |
329
|
|
|
{ |
330
|
|
|
return $this->exposureTime; |
331
|
|
|
} |
332
|
|
|
|
333
|
|
|
/** |
334
|
|
|
* {@inheritDoc} |
335
|
|
|
*/ |
336
|
|
|
public function withExposureTime(ExposureTime $exposureTime) |
337
|
|
|
{ |
338
|
|
|
$new = clone $this; |
339
|
|
|
$new->exposureTime = $exposureTime; |
340
|
|
|
|
341
|
|
|
return $new; |
342
|
|
|
} |
343
|
|
|
|
344
|
|
|
/** |
345
|
|
|
* {@inheritDoc} |
346
|
|
|
*/ |
347
|
|
|
public function getIsoSpeed() |
348
|
|
|
{ |
349
|
|
|
return $this->isoSpeed; |
350
|
|
|
} |
351
|
|
|
|
352
|
|
|
/** |
353
|
|
|
* {@inheritDoc} |
354
|
|
|
*/ |
355
|
|
|
public function withIsoSpeed(IsoSpeed $isoSpeed) |
356
|
|
|
{ |
357
|
|
|
$new = clone $this; |
358
|
|
|
$new->isoSpeed = $isoSpeed; |
359
|
|
|
|
360
|
|
|
return $new; |
361
|
|
|
} |
362
|
|
|
|
363
|
|
|
/** |
364
|
|
|
* {@inheritDoc} |
365
|
|
|
*/ |
366
|
|
|
public function getCreationDate() |
367
|
|
|
{ |
368
|
|
|
return $this->creationDate; |
369
|
|
|
} |
370
|
|
|
|
371
|
|
|
/** |
372
|
|
|
* {@inheritDoc} |
373
|
|
|
*/ |
374
|
|
|
public function withCreationDate(DateTimeImmutable $date) |
375
|
|
|
{ |
376
|
|
|
$new = clone $this; |
377
|
|
|
$new->creationDate = $date; |
378
|
|
|
|
379
|
|
|
return $new; |
380
|
|
|
} |
381
|
|
|
|
382
|
|
|
/** |
383
|
|
|
* {@inheritDoc} |
384
|
|
|
*/ |
385
|
|
|
public function getResolution() |
386
|
|
|
{ |
387
|
|
|
return $this->resolution; |
388
|
|
|
} |
389
|
|
|
|
390
|
|
|
/** |
391
|
|
|
* {@inheritDoc} |
392
|
|
|
*/ |
393
|
|
|
public function withResolution(Resolution $resolution) |
394
|
|
|
{ |
395
|
|
|
$new = clone $this; |
396
|
|
|
$new->resolution = $resolution; |
397
|
|
|
|
398
|
|
|
return $new; |
399
|
|
|
} |
400
|
|
|
} |
401
|
|
|
|