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.
Completed
Pull Request — develop (#39)
by Tom Van
02:09
created

MeasuredObject::getValue()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
/**
3
 * PHP Exif MeasuredObject abstract 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 \JsonSerializable;
16
17
/**
18
 * MeasuredObject class
19
 *
20
 * Describes a measured object
21
 *
22
 * @category    PHPExif
23
 * @package     Common
24
 */
25
abstract class MeasuredObject implements JsonSerializable
26
{
27
    /**
28
     * Contains the value
29
     *
30
     * @var mixed
31
     */
32
    protected $value;
33
34
    /**
35
     * Contains the unit of measurement
36
     *
37
     * @var Unit
38
     */
39
    protected $unit;
40
41
    /**
42
     * @param mixed $value
43
     * @param Unit $unit
44
     *
45
     * @throws InvalidArgumentException If given data is not an integer
46
     */
47
    public function __construct($value, Unit $unit)
48
    {
49
        $this->setValue($value);
50
        $this->setUnit($unit);
51
    }
52
53
    /**
54
     * Sets the value
55
     *
56
     * @param mixed $value
57
     *
58
     * @return void
59
     */
60
    protected function setValue($value)
61
    {
62
        $this->value = $value;
63
    }
64
65
    /**
66
     * Sets the unit
67
     *
68
     * @param Unit $unit
69
     *
70
     * @return void
71
     */
72
    protected function setUnit(Unit $unit)
73
    {
74
        $this->unit = $unit;
75
    }
76
77
    /**
78
     * Getter for value
79
     *
80
     * @return mixed
81
     */
82
    public function getValue()
83
    {
84
        return $this->value;
85
    }
86
87
    /**
88
     * Getter for unit
89
     *
90
     * @return Unit
91
     */
92
    public function getUnit()
93
    {
94
        return $this->unit;
95
    }
96
97
    /**
98
     * @inheritDoc
99
     *
100
     * @return string
101
     */
102
    public function jsonSerialize()
103
    {
104
        return [
105
            'value' => $this->getValue(),
106
            'unit' => (string) $this->getUnit(),
107
        ];
108
    }
109
110
    /**
111
     * Returns string representation
112
     *
113
     * @return string
114
     */
115
    public function __toString()
116
    {
117
        return (string) $this->getValue() . (string) $this->getUnit();
118
    }
119
}
120