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