GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Exif   A
last analyzed

Complexity

Total Complexity 34

Size/Duplication

Total Lines 406
Duplicated Lines 3.45 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 34
c 1
b 0
f 0
lcom 1
cbo 0
dl 14
loc 406
rs 9.2

33 Methods

Rating   Name   Duplication   Size   Complexity  
A getAperture() 0 4 1
A withAperture() 0 7 1
A getMimeType() 0 4 1
A withMimeType() 0 7 1
A getFilename() 0 4 1
A withFilename() 0 7 1
A getFilesize() 0 4 1
A withFilesize() 0 7 1
A getMake() 0 4 1
A withMake() 0 7 1
A getModel() 0 4 1
A withModel() 0 7 1
A getSoftware() 0 4 1
A withSoftware() 0 7 1
A getAuthor() 0 4 1
A withAuthor() 0 7 1
A getDimensions() 0 4 1
A withDimensions() 0 7 1
A getFocalLength() 0 4 1
A withFocalLength() 0 7 1
A getFocusDistance() 0 4 1
A withFocusDistance() 0 7 1
A getExposureTime() 0 4 1
A withExposureTime() 0 7 1
A getIsoSpeed() 0 4 1
A withIsoSpeed() 0 7 1
A getCreationDate() 0 4 1
A withCreationDate() 0 7 1
A getResolution() 0 4 1
A withResolution() 0 7 1
A getCoordinates() 0 4 1
A withCoordinates() 0 7 1
A jsonSerialize() 14 14 2

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

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

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
435
    {
436
        $reflObject = new ReflectionObject($this);
437
        $properties = $reflObject->getProperties(ReflectionProperty::IS_PROTECTED);
438
439
        $data = [];
440
        foreach ($properties as $property) {
441
            $propertyName = $property->getName();
442
443
            $data[$propertyName] = $this->{$propertyName};
444
        }
445
446
        return $data;
447
    }
448
}
449