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\Coordinates; |
17
|
|
|
use PHPExif\Common\Data\ValueObject\Dimensions; |
18
|
|
|
use PHPExif\Common\Data\ValueObject\ExposureTime; |
19
|
|
|
use PHPExif\Common\Data\ValueObject\Filename; |
20
|
|
|
use PHPExif\Common\Data\ValueObject\Filesize; |
21
|
|
|
use PHPExif\Common\Data\ValueObject\FocalLength; |
22
|
|
|
use PHPExif\Common\Data\ValueObject\FocusDistance; |
23
|
|
|
use PHPExif\Common\Data\ValueObject\IsoSpeed; |
24
|
|
|
use PHPExif\Common\Data\ValueObject\LineResolution; |
25
|
|
|
use PHPExif\Common\Data\ValueObject\Make; |
26
|
|
|
use PHPExif\Common\Data\ValueObject\MimeType; |
27
|
|
|
use PHPExif\Common\Data\ValueObject\Model; |
28
|
|
|
use PHPExif\Common\Data\ValueObject\Resolution; |
29
|
|
|
use PHPExif\Common\Data\ValueObject\Software; |
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 Coordinates |
54
|
|
|
*/ |
55
|
|
|
protected $coordinates; |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* @var DateTimeImmutable |
59
|
|
|
*/ |
60
|
|
|
protected $creationDate; |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* @var Dimensions |
64
|
|
|
*/ |
65
|
|
|
protected $dimensions; |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* @var ExposureTime |
69
|
|
|
*/ |
70
|
|
|
protected $exposureTime; |
71
|
|
|
|
72
|
|
|
/** |
73
|
|
|
* @var Filename |
74
|
|
|
*/ |
75
|
|
|
protected $filename; |
76
|
|
|
|
77
|
|
|
/** |
78
|
|
|
* @var Filesize |
79
|
|
|
*/ |
80
|
|
|
protected $filesize; |
81
|
|
|
|
82
|
|
|
/** |
83
|
|
|
* @var FocalLength |
84
|
|
|
*/ |
85
|
|
|
protected $focalLength; |
86
|
|
|
|
87
|
|
|
/** |
88
|
|
|
* @var FocusDistance |
89
|
|
|
*/ |
90
|
|
|
protected $focusDistance; |
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 Resolution |
114
|
|
|
*/ |
115
|
|
|
protected $resolution; |
116
|
|
|
|
117
|
|
|
/** |
118
|
|
|
* @var Software |
119
|
|
|
*/ |
120
|
|
|
protected $software; |
121
|
|
|
|
122
|
|
|
/** |
123
|
|
|
* {@inheritDoc} |
124
|
|
|
*/ |
125
|
|
|
public function getAperture() |
126
|
|
|
{ |
127
|
|
|
return $this->aperture; |
128
|
|
|
} |
129
|
|
|
|
130
|
|
|
/** |
131
|
|
|
* {@inheritDoc} |
132
|
|
|
*/ |
133
|
|
|
public function withAperture(Aperture $aperture) |
134
|
|
|
{ |
135
|
|
|
$new = clone $this; |
136
|
|
|
$new->aperture = $aperture; |
137
|
|
|
|
138
|
|
|
return $new; |
139
|
|
|
} |
140
|
|
|
|
141
|
|
|
/** |
142
|
|
|
* {@inheritDoc} |
143
|
|
|
*/ |
144
|
|
|
public function getMimeType() |
145
|
|
|
{ |
146
|
|
|
return $this->mimeType; |
147
|
|
|
} |
148
|
|
|
|
149
|
|
|
/** |
150
|
|
|
* {@inheritDoc} |
151
|
|
|
*/ |
152
|
|
|
public function withMimeType(MimeType $mimeType) |
153
|
|
|
{ |
154
|
|
|
$new = clone $this; |
155
|
|
|
$new->mimeType = $mimeType; |
156
|
|
|
|
157
|
|
|
return $new; |
158
|
|
|
} |
159
|
|
|
|
160
|
|
|
/** |
161
|
|
|
* {@inheritDoc} |
162
|
|
|
*/ |
163
|
|
|
public function getFilename() |
164
|
|
|
{ |
165
|
|
|
return $this->filename; |
166
|
|
|
} |
167
|
|
|
|
168
|
|
|
/** |
169
|
|
|
* {@inheritDoc} |
170
|
|
|
*/ |
171
|
|
|
public function withFilename(Filename $filename) |
172
|
|
|
{ |
173
|
|
|
$new = clone $this; |
174
|
|
|
$new->filename = $filename; |
175
|
|
|
|
176
|
|
|
return $new; |
177
|
|
|
} |
178
|
|
|
|
179
|
|
|
/** |
180
|
|
|
* {@inheritDoc} |
181
|
|
|
*/ |
182
|
|
|
public function getFilesize() |
183
|
|
|
{ |
184
|
|
|
return $this->filesize; |
185
|
|
|
} |
186
|
|
|
|
187
|
|
|
/** |
188
|
|
|
* {@inheritDoc} |
189
|
|
|
*/ |
190
|
|
|
public function withFilesize(Filesize $filesize) |
191
|
|
|
{ |
192
|
|
|
$new = clone $this; |
193
|
|
|
$new->filesize = $filesize; |
194
|
|
|
|
195
|
|
|
return $new; |
196
|
|
|
} |
197
|
|
|
|
198
|
|
|
/** |
199
|
|
|
* {@inheritDoc} |
200
|
|
|
*/ |
201
|
|
|
public function getMake() |
202
|
|
|
{ |
203
|
|
|
return $this->make; |
204
|
|
|
} |
205
|
|
|
|
206
|
|
|
/** |
207
|
|
|
* {@inheritDoc} |
208
|
|
|
*/ |
209
|
|
|
public function withMake(Make $make) |
210
|
|
|
{ |
211
|
|
|
$new = clone $this; |
212
|
|
|
$new->make = $make; |
213
|
|
|
|
214
|
|
|
return $new; |
215
|
|
|
} |
216
|
|
|
|
217
|
|
|
/** |
218
|
|
|
* {@inheritDoc} |
219
|
|
|
*/ |
220
|
|
|
public function getModel() |
221
|
|
|
{ |
222
|
|
|
return $this->model; |
223
|
|
|
} |
224
|
|
|
|
225
|
|
|
/** |
226
|
|
|
* {@inheritDoc} |
227
|
|
|
*/ |
228
|
|
|
public function withModel(Model $model) |
229
|
|
|
{ |
230
|
|
|
$new = clone $this; |
231
|
|
|
$new->model = $model; |
232
|
|
|
|
233
|
|
|
return $new; |
234
|
|
|
} |
235
|
|
|
|
236
|
|
|
/** |
237
|
|
|
* {@inheritDoc} |
238
|
|
|
*/ |
239
|
|
|
public function getSoftware() |
240
|
|
|
{ |
241
|
|
|
return $this->software; |
242
|
|
|
} |
243
|
|
|
|
244
|
|
|
/** |
245
|
|
|
* {@inheritDoc} |
246
|
|
|
*/ |
247
|
|
|
public function withSoftware(Software $software) |
248
|
|
|
{ |
249
|
|
|
$new = clone $this; |
250
|
|
|
$new->software = $software; |
251
|
|
|
|
252
|
|
|
return $new; |
253
|
|
|
} |
254
|
|
|
|
255
|
|
|
/** |
256
|
|
|
* {@inheritDoc} |
257
|
|
|
*/ |
258
|
|
|
public function getAuthor() |
259
|
|
|
{ |
260
|
|
|
return $this->author; |
261
|
|
|
} |
262
|
|
|
|
263
|
|
|
/** |
264
|
|
|
* {@inheritDoc} |
265
|
|
|
*/ |
266
|
|
|
public function withAuthor(Author $author) |
267
|
|
|
{ |
268
|
|
|
$new = clone $this; |
269
|
|
|
$new->author = $author; |
270
|
|
|
|
271
|
|
|
return $new; |
272
|
|
|
} |
273
|
|
|
|
274
|
|
|
/** |
275
|
|
|
* {@inheritDoc} |
276
|
|
|
*/ |
277
|
|
|
public function getDimensions() |
278
|
|
|
{ |
279
|
|
|
return $this->dimensions; |
280
|
|
|
} |
281
|
|
|
|
282
|
|
|
/** |
283
|
|
|
* {@inheritDoc} |
284
|
|
|
*/ |
285
|
|
|
public function withDimensions(Dimensions $dimensions) |
286
|
|
|
{ |
287
|
|
|
$new = clone $this; |
288
|
|
|
$new->dimensions = $dimensions; |
289
|
|
|
|
290
|
|
|
return $new; |
291
|
|
|
} |
292
|
|
|
|
293
|
|
|
/** |
294
|
|
|
* {@inheritDoc} |
295
|
|
|
*/ |
296
|
|
|
public function getFocalLength() |
297
|
|
|
{ |
298
|
|
|
return $this->focalLength; |
299
|
|
|
} |
300
|
|
|
|
301
|
|
|
/** |
302
|
|
|
* {@inheritDoc} |
303
|
|
|
*/ |
304
|
|
|
public function withFocalLength(FocalLength $focalLength) |
305
|
|
|
{ |
306
|
|
|
$new = clone $this; |
307
|
|
|
$new->focalLength = $focalLength; |
308
|
|
|
|
309
|
|
|
return $new; |
310
|
|
|
} |
311
|
|
|
|
312
|
|
|
/** |
313
|
|
|
* {@inheritDoc} |
314
|
|
|
*/ |
315
|
|
|
public function getFocusDistance() |
316
|
|
|
{ |
317
|
|
|
return $this->focusDistance; |
318
|
|
|
} |
319
|
|
|
|
320
|
|
|
/** |
321
|
|
|
* {@inheritDoc} |
322
|
|
|
*/ |
323
|
|
|
public function withFocusDistance(FocusDistance $focusDistance) |
324
|
|
|
{ |
325
|
|
|
$new = clone $this; |
326
|
|
|
$new->focusDistance = $focusDistance; |
327
|
|
|
|
328
|
|
|
return $new; |
329
|
|
|
} |
330
|
|
|
|
331
|
|
|
/** |
332
|
|
|
* {@inheritDoc} |
333
|
|
|
*/ |
334
|
|
|
public function getExposureTime() |
335
|
|
|
{ |
336
|
|
|
return $this->exposureTime; |
337
|
|
|
} |
338
|
|
|
|
339
|
|
|
/** |
340
|
|
|
* {@inheritDoc} |
341
|
|
|
*/ |
342
|
|
|
public function withExposureTime(ExposureTime $exposureTime) |
343
|
|
|
{ |
344
|
|
|
$new = clone $this; |
345
|
|
|
$new->exposureTime = $exposureTime; |
346
|
|
|
|
347
|
|
|
return $new; |
348
|
|
|
} |
349
|
|
|
|
350
|
|
|
/** |
351
|
|
|
* {@inheritDoc} |
352
|
|
|
*/ |
353
|
|
|
public function getIsoSpeed() |
354
|
|
|
{ |
355
|
|
|
return $this->isoSpeed; |
356
|
|
|
} |
357
|
|
|
|
358
|
|
|
/** |
359
|
|
|
* {@inheritDoc} |
360
|
|
|
*/ |
361
|
|
|
public function withIsoSpeed(IsoSpeed $isoSpeed) |
362
|
|
|
{ |
363
|
|
|
$new = clone $this; |
364
|
|
|
$new->isoSpeed = $isoSpeed; |
365
|
|
|
|
366
|
|
|
return $new; |
367
|
|
|
} |
368
|
|
|
|
369
|
|
|
/** |
370
|
|
|
* {@inheritDoc} |
371
|
|
|
*/ |
372
|
|
|
public function getCreationDate() |
373
|
|
|
{ |
374
|
|
|
return $this->creationDate; |
375
|
|
|
} |
376
|
|
|
|
377
|
|
|
/** |
378
|
|
|
* {@inheritDoc} |
379
|
|
|
*/ |
380
|
|
|
public function withCreationDate(DateTimeImmutable $date) |
381
|
|
|
{ |
382
|
|
|
$new = clone $this; |
383
|
|
|
$new->creationDate = $date; |
384
|
|
|
|
385
|
|
|
return $new; |
386
|
|
|
} |
387
|
|
|
|
388
|
|
|
/** |
389
|
|
|
* {@inheritDoc} |
390
|
|
|
*/ |
391
|
|
|
public function getResolution() |
392
|
|
|
{ |
393
|
|
|
return $this->resolution; |
394
|
|
|
} |
395
|
|
|
|
396
|
|
|
/** |
397
|
|
|
* {@inheritDoc} |
398
|
|
|
*/ |
399
|
|
|
public function withResolution(Resolution $resolution) |
400
|
|
|
{ |
401
|
|
|
$new = clone $this; |
402
|
|
|
$new->resolution = $resolution; |
403
|
|
|
|
404
|
|
|
return $new; |
405
|
|
|
} |
406
|
|
|
|
407
|
|
|
/** |
408
|
|
|
* {@inheritDoc} |
409
|
|
|
*/ |
410
|
|
|
public function getCoordinates() |
411
|
|
|
{ |
412
|
|
|
return $this->coordinates; |
413
|
|
|
} |
414
|
|
|
|
415
|
|
|
/** |
416
|
|
|
* {@inheritDoc} |
417
|
|
|
*/ |
418
|
|
|
public function withCoordinates(Coordinates $coordinates) |
419
|
|
|
{ |
420
|
|
|
$new = clone $this; |
421
|
|
|
$new->coordinates = $coordinates; |
422
|
|
|
|
423
|
|
|
return $new; |
424
|
|
|
} |
425
|
|
|
} |
426
|
|
|
|