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