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.

Dimensions   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 108
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 8
c 0
b 0
f 0
lcom 1
cbo 0
dl 0
loc 108
rs 10

8 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A setWidth() 0 4 1
A setHeight() 0 4 1
A getWidth() 0 4 1
A getHeight() 0 4 1
A fromDimensions() 0 7 1
A jsonSerialize() 0 7 1
A __toString() 0 8 1
1
<?php
2
/**
3
 * PHP Exif Dimensions ValueObject
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
 * @codeCoverageIgnore
11
 */
12
13
namespace PHPExif\Common\Data\ValueObject;
14
15
use \InvalidArgumentException;
16
use \JsonSerializable;
17
use \RuntimeException;
18
19
/**
20
 * Aperture class
21
 *
22
 * A value object to describe the Aperture f-number
23
 *
24
 * @category    PHPExif
25
 * @package     Common
26
 */
27
class Dimensions implements JsonSerializable
28
{
29
    /**
30
     * The width
31
     *
32
     * @var Width
33
     */
34
    private $width;
35
36
    /**
37
     * The height
38
     *
39
     * @var Height
40
     */
41
    private $height;
42
43
    public function __construct(Width $width, Height $height)
44
    {
45
        $this->setWidth($width);
46
        $this->setHeight($height);
47
    }
48
49
    /**
50
     * Sets the width
51
     *
52
     * @param Width $width
53
     *
54
     * @return void
55
     */
56
    private function setWidth(Width $width)
57
    {
58
        $this->width = $width;
59
    }
60
61
    /**
62
     * Sets the height
63
     *
64
     * @param Height $height
65
     *
66
     * @return void
67
     */
68
    private function setHeight(Height $height)
69
    {
70
        $this->height = $height;
71
    }
72
73
    /**
74
     * Getter for width
75
     *
76
     * @return Width
77
     */
78
    public function getWidth()
79
    {
80
        return $this->width;
81
    }
82
83
    /**
84
     * Getter for height
85
     *
86
     * @return Height
87
     */
88
    public function getHeight()
89
    {
90
        return $this->height;
91
    }
92
93
    /**
94
     * Creates a new instance from given Dimensions object
95
     *
96
     * @param Dimensions $dimensions
97
     *
98
     * @return Dimensions
99
     */
100
    public static function fromDimensions(Dimensions $dimensions)
101
    {
102
        return new self(
103
            (clone $dimensions->getWidth()),
104
            (clone $dimensions->getHeight())
105
        );
106
    }
107
108
    /**
109
     * @inheritDoc
110
     *
111
     * @return string
112
     */
113
    public function jsonSerialize()
114
    {
115
        return [
116
            'width' => $this->getWidth(),
117
            'height' => $this->getHeight(),
118
        ];
119
    }
120
121
    /**
122
     * Returns string representation
123
     *
124
     * @return string
125
     */
126
    public function __toString()
127
    {
128
        return sprintf(
129
            '%1$s x %2$s',
130
            (string) $this->getWidth(),
131
            (string) $this->getHeight()
132
        );
133
    }
134
}
135