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\ExposureTime; |
17
|
|
|
use PHPExif\Common\Data\ValueObject\Filename; |
18
|
|
|
use PHPExif\Common\Data\ValueObject\Filesize; |
19
|
|
|
use PHPExif\Common\Data\ValueObject\FocalLength; |
20
|
|
|
use PHPExif\Common\Data\ValueObject\FocusDistance; |
21
|
|
|
use PHPExif\Common\Data\ValueObject\Height; |
22
|
|
|
use PHPExif\Common\Data\ValueObject\HorizontalResolution; |
23
|
|
|
use PHPExif\Common\Data\ValueObject\IsoSpeed; |
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\Software; |
28
|
|
|
use PHPExif\Common\Data\ValueObject\VerticalResolution; |
29
|
|
|
use PHPExif\Common\Data\ValueObject\Width; |
30
|
|
|
use \DateTimeImmutable; |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* Exif class |
34
|
|
|
* |
35
|
|
|
* Container for EXIF data |
36
|
|
|
* |
37
|
|
|
* @category PHPExif |
38
|
|
|
* @package Common |
39
|
|
|
*/ |
40
|
|
|
class Exif implements ExifInterface |
41
|
|
|
{ |
42
|
|
|
/** |
43
|
|
|
* @var Aperture |
44
|
|
|
*/ |
45
|
|
|
protected $aperture; |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* @var Author |
49
|
|
|
*/ |
50
|
|
|
protected $author; |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* @var DateTimeImmutable |
54
|
|
|
*/ |
55
|
|
|
protected $creationDate; |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* @var ExposureTime |
59
|
|
|
*/ |
60
|
|
|
protected $exposureTime; |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* @var Filename |
64
|
|
|
*/ |
65
|
|
|
protected $filename; |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* @var Filesize |
69
|
|
|
*/ |
70
|
|
|
protected $filesize; |
71
|
|
|
|
72
|
|
|
/** |
73
|
|
|
* @var FocalLength |
74
|
|
|
*/ |
75
|
|
|
protected $focalLength; |
76
|
|
|
|
77
|
|
|
/** |
78
|
|
|
* @var FocusDistance |
79
|
|
|
*/ |
80
|
|
|
protected $focusDistance; |
81
|
|
|
|
82
|
|
|
/** |
83
|
|
|
* @var Height |
84
|
|
|
*/ |
85
|
|
|
protected $height; |
86
|
|
|
|
87
|
|
|
/** |
88
|
|
|
* @var HorizontalResolution |
89
|
|
|
*/ |
90
|
|
|
protected $horizontalResolution; |
91
|
|
|
|
92
|
|
|
/** |
93
|
|
|
* @var IsoSpeed |
94
|
|
|
*/ |
95
|
|
|
protected $isoSpeed; |
96
|
|
|
|
97
|
|
|
/** |
98
|
|
|
* @var Make |
99
|
|
|
*/ |
100
|
|
|
protected $make; |
101
|
|
|
|
102
|
|
|
/** |
103
|
|
|
* @var Model |
104
|
|
|
*/ |
105
|
|
|
protected $model; |
106
|
|
|
|
107
|
|
|
/** |
108
|
|
|
* @var MimeType |
109
|
|
|
*/ |
110
|
|
|
protected $mimeType; |
111
|
|
|
|
112
|
|
|
/** |
113
|
|
|
* @var Software |
114
|
|
|
*/ |
115
|
|
|
protected $software; |
116
|
|
|
|
117
|
|
|
/** |
118
|
|
|
* @var VerticalResolution |
119
|
|
|
*/ |
120
|
|
|
protected $verticalResolution; |
121
|
|
|
|
122
|
|
|
/** |
123
|
|
|
* @var Width |
124
|
|
|
*/ |
125
|
|
|
protected $width; |
126
|
|
|
|
127
|
|
|
/** |
128
|
|
|
* {@inheritDoc} |
129
|
|
|
*/ |
130
|
|
|
public function getAperture() |
131
|
|
|
{ |
132
|
|
|
return $this->aperture; |
133
|
|
|
} |
134
|
|
|
|
135
|
|
|
/** |
136
|
|
|
* {@inheritDoc} |
137
|
|
|
*/ |
138
|
|
|
public function withAperture(Aperture $aperture) |
139
|
|
|
{ |
140
|
|
|
$new = clone $this; |
141
|
|
|
$new->aperture = $aperture; |
142
|
|
|
|
143
|
|
|
return $new; |
144
|
|
|
} |
145
|
|
|
|
146
|
|
|
/** |
147
|
|
|
* {@inheritDoc} |
148
|
|
|
*/ |
149
|
|
|
public function getMimeType() |
150
|
|
|
{ |
151
|
|
|
return $this->mimeType; |
152
|
|
|
} |
153
|
|
|
|
154
|
|
|
/** |
155
|
|
|
* {@inheritDoc} |
156
|
|
|
*/ |
157
|
|
|
public function withMimeType(MimeType $mimeType) |
158
|
|
|
{ |
159
|
|
|
$new = clone $this; |
160
|
|
|
$new->mimeType = $mimeType; |
161
|
|
|
|
162
|
|
|
return $new; |
163
|
|
|
} |
164
|
|
|
|
165
|
|
|
/** |
166
|
|
|
* {@inheritDoc} |
167
|
|
|
*/ |
168
|
|
|
public function getFilename() |
169
|
|
|
{ |
170
|
|
|
return $this->filename; |
171
|
|
|
} |
172
|
|
|
|
173
|
|
|
/** |
174
|
|
|
* {@inheritDoc} |
175
|
|
|
*/ |
176
|
|
|
public function withFilename(Filename $filename) |
177
|
|
|
{ |
178
|
|
|
$new = clone $this; |
179
|
|
|
$new->filename = $filename; |
180
|
|
|
|
181
|
|
|
return $new; |
182
|
|
|
} |
183
|
|
|
|
184
|
|
|
/** |
185
|
|
|
* {@inheritDoc} |
186
|
|
|
*/ |
187
|
|
|
public function getFilesize() |
188
|
|
|
{ |
189
|
|
|
return $this->filesize; |
190
|
|
|
} |
191
|
|
|
|
192
|
|
|
/** |
193
|
|
|
* {@inheritDoc} |
194
|
|
|
*/ |
195
|
|
|
public function withFilesize(Filesize $filesize) |
196
|
|
|
{ |
197
|
|
|
$new = clone $this; |
198
|
|
|
$new->filesize = $filesize; |
199
|
|
|
|
200
|
|
|
return $new; |
201
|
|
|
} |
202
|
|
|
|
203
|
|
|
/** |
204
|
|
|
* {@inheritDoc} |
205
|
|
|
*/ |
206
|
|
|
public function getMake() |
207
|
|
|
{ |
208
|
|
|
return $this->make; |
209
|
|
|
} |
210
|
|
|
|
211
|
|
|
/** |
212
|
|
|
* {@inheritDoc} |
213
|
|
|
*/ |
214
|
|
|
public function withMake(Make $make) |
215
|
|
|
{ |
216
|
|
|
$new = clone $this; |
217
|
|
|
$new->make = $make; |
218
|
|
|
|
219
|
|
|
return $new; |
220
|
|
|
} |
221
|
|
|
|
222
|
|
|
/** |
223
|
|
|
* {@inheritDoc} |
224
|
|
|
*/ |
225
|
|
|
public function getModel() |
226
|
|
|
{ |
227
|
|
|
return $this->model; |
228
|
|
|
} |
229
|
|
|
|
230
|
|
|
/** |
231
|
|
|
* {@inheritDoc} |
232
|
|
|
*/ |
233
|
|
|
public function withModel(Model $model) |
234
|
|
|
{ |
235
|
|
|
$new = clone $this; |
236
|
|
|
$new->model = $model; |
237
|
|
|
|
238
|
|
|
return $new; |
239
|
|
|
} |
240
|
|
|
|
241
|
|
|
/** |
242
|
|
|
* {@inheritDoc} |
243
|
|
|
*/ |
244
|
|
|
public function getSoftware() |
245
|
|
|
{ |
246
|
|
|
return $this->software; |
247
|
|
|
} |
248
|
|
|
|
249
|
|
|
/** |
250
|
|
|
* {@inheritDoc} |
251
|
|
|
*/ |
252
|
|
|
public function withSoftware(Software $software) |
253
|
|
|
{ |
254
|
|
|
$new = clone $this; |
255
|
|
|
$new->software = $software; |
256
|
|
|
|
257
|
|
|
return $new; |
258
|
|
|
} |
259
|
|
|
|
260
|
|
|
/** |
261
|
|
|
* {@inheritDoc} |
262
|
|
|
*/ |
263
|
|
|
public function getAuthor() |
264
|
|
|
{ |
265
|
|
|
return $this->author; |
266
|
|
|
} |
267
|
|
|
|
268
|
|
|
/** |
269
|
|
|
* {@inheritDoc} |
270
|
|
|
*/ |
271
|
|
|
public function withAuthor(Author $author) |
272
|
|
|
{ |
273
|
|
|
$new = clone $this; |
274
|
|
|
$new->author = $author; |
275
|
|
|
|
276
|
|
|
return $new; |
277
|
|
|
} |
278
|
|
|
|
279
|
|
|
/** |
280
|
|
|
* {@inheritDoc} |
281
|
|
|
*/ |
282
|
|
|
public function getWidth() |
283
|
|
|
{ |
284
|
|
|
return $this->width; |
285
|
|
|
} |
286
|
|
|
|
287
|
|
|
/** |
288
|
|
|
* {@inheritDoc} |
289
|
|
|
*/ |
290
|
|
|
public function withWidth(Width $width) |
291
|
|
|
{ |
292
|
|
|
$new = clone $this; |
293
|
|
|
$new->width = $width; |
294
|
|
|
|
295
|
|
|
return $new; |
296
|
|
|
} |
297
|
|
|
|
298
|
|
|
/** |
299
|
|
|
* {@inheritDoc} |
300
|
|
|
*/ |
301
|
|
|
public function getHeight() |
302
|
|
|
{ |
303
|
|
|
return $this->height; |
304
|
|
|
} |
305
|
|
|
|
306
|
|
|
/** |
307
|
|
|
* {@inheritDoc} |
308
|
|
|
*/ |
309
|
|
|
public function withHeight(Height $height) |
310
|
|
|
{ |
311
|
|
|
$new = clone $this; |
312
|
|
|
$new->height = $height; |
313
|
|
|
|
314
|
|
|
return $new; |
315
|
|
|
} |
316
|
|
|
|
317
|
|
|
/** |
318
|
|
|
* {@inheritDoc} |
319
|
|
|
*/ |
320
|
|
|
public function getFocalLength() |
321
|
|
|
{ |
322
|
|
|
return $this->focalLength; |
323
|
|
|
} |
324
|
|
|
|
325
|
|
|
/** |
326
|
|
|
* {@inheritDoc} |
327
|
|
|
*/ |
328
|
|
|
public function withFocalLength(FocalLength $focalLength) |
329
|
|
|
{ |
330
|
|
|
$new = clone $this; |
331
|
|
|
$new->focalLength = $focalLength; |
332
|
|
|
|
333
|
|
|
return $new; |
334
|
|
|
} |
335
|
|
|
|
336
|
|
|
/** |
337
|
|
|
* {@inheritDoc} |
338
|
|
|
*/ |
339
|
|
|
public function getFocusDistance() |
340
|
|
|
{ |
341
|
|
|
return $this->focusDistance; |
342
|
|
|
} |
343
|
|
|
|
344
|
|
|
/** |
345
|
|
|
* {@inheritDoc} |
346
|
|
|
*/ |
347
|
|
|
public function withFocusDistance(FocusDistance $focusDistance) |
348
|
|
|
{ |
349
|
|
|
$new = clone $this; |
350
|
|
|
$new->focusDistance = $focusDistance; |
351
|
|
|
|
352
|
|
|
return $new; |
353
|
|
|
} |
354
|
|
|
|
355
|
|
|
/** |
356
|
|
|
* {@inheritDoc} |
357
|
|
|
*/ |
358
|
|
|
public function getHorizontalResolution() |
359
|
|
|
{ |
360
|
|
|
return $this->horizontalResolution; |
361
|
|
|
} |
362
|
|
|
|
363
|
|
|
/** |
364
|
|
|
* {@inheritDoc} |
365
|
|
|
*/ |
366
|
|
|
public function withHorizontalResolution(HorizontalResolution $horizontalResolution) |
367
|
|
|
{ |
368
|
|
|
$new = clone $this; |
369
|
|
|
$new->horizontalResolution = $horizontalResolution; |
370
|
|
|
|
371
|
|
|
return $new; |
372
|
|
|
} |
373
|
|
|
|
374
|
|
|
/** |
375
|
|
|
* {@inheritDoc} |
376
|
|
|
*/ |
377
|
|
|
public function getVerticalResolution() |
378
|
|
|
{ |
379
|
|
|
return $this->verticalResolution; |
380
|
|
|
} |
381
|
|
|
|
382
|
|
|
/** |
383
|
|
|
* {@inheritDoc} |
384
|
|
|
*/ |
385
|
|
|
public function withVerticalResolution(VerticalResolution $verticalResolution) |
386
|
|
|
{ |
387
|
|
|
$new = clone $this; |
388
|
|
|
$new->verticalResolution = $verticalResolution; |
389
|
|
|
|
390
|
|
|
return $new; |
391
|
|
|
} |
392
|
|
|
|
393
|
|
|
/** |
394
|
|
|
* {@inheritDoc} |
395
|
|
|
*/ |
396
|
|
|
public function getExposureTime() |
397
|
|
|
{ |
398
|
|
|
return $this->exposureTime; |
399
|
|
|
} |
400
|
|
|
|
401
|
|
|
/** |
402
|
|
|
* {@inheritDoc} |
403
|
|
|
*/ |
404
|
|
|
public function withExposureTime(ExposureTime $exposureTime) |
405
|
|
|
{ |
406
|
|
|
$new = clone $this; |
407
|
|
|
$new->exposureTime = $exposureTime; |
408
|
|
|
|
409
|
|
|
return $new; |
410
|
|
|
} |
411
|
|
|
|
412
|
|
|
/** |
413
|
|
|
* {@inheritDoc} |
414
|
|
|
*/ |
415
|
|
|
public function getIsoSpeed() |
416
|
|
|
{ |
417
|
|
|
return $this->isoSpeed; |
418
|
|
|
} |
419
|
|
|
|
420
|
|
|
/** |
421
|
|
|
* {@inheritDoc} |
422
|
|
|
*/ |
423
|
|
|
public function withIsoSpeed(IsoSpeed $isoSpeed) |
424
|
|
|
{ |
425
|
|
|
$new = clone $this; |
426
|
|
|
$new->isoSpeed = $isoSpeed; |
427
|
|
|
|
428
|
|
|
return $new; |
429
|
|
|
} |
430
|
|
|
|
431
|
|
|
/** |
432
|
|
|
* {@inheritDoc} |
433
|
|
|
*/ |
434
|
|
|
public function getCreationDate() |
435
|
|
|
{ |
436
|
|
|
return $this->creationDate; |
437
|
|
|
} |
438
|
|
|
|
439
|
|
|
/** |
440
|
|
|
* {@inheritDoc} |
441
|
|
|
*/ |
442
|
|
|
public function withCreationDate(DateTimeImmutable $date) |
443
|
|
|
{ |
444
|
|
|
$new = clone $this; |
445
|
|
|
$new->creationDate = $date; |
446
|
|
|
|
447
|
|
|
return $new; |
448
|
|
|
} |
449
|
|
|
} |
450
|
|
|
|