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