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

FloatObject::jsonSerialize()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 4
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
/**
3
 * PHP Exif General Float 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
 * FloatObject class
21
 *
22
 * Abstract class for objects with only float data
23
 *
24
 * @category    PHPExif
25
 * @package     Common
26
 */
27 View Code Duplication
abstract class FloatObject implements JsonSerializable
0 ignored issues
show
Duplication introduced by
This class 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...
28
{
29
    /**
30
     * Contains the value
31
     *
32
     * @var float
33
     */
34
    protected $value;
35
36
    /**
37
     * @param int $value
38
     *
39
     * @throws InvalidArgumentException If given data is not an float
40
     */
41
    public function __construct($value)
42
    {
43
        if (!is_float($value)) {
44
            throw new InvalidArgumentException('Given data is not a float');
45
        }
46
47
        $this->setValue($value);
48
    }
49
50
    /**
51
     * Sets the value
52
     *
53
     * @param float $value
54
     *
55
     * @return void
56
     */
57
    protected function setValue($value)
58
    {
59
        $this->value = $value;
60
    }
61
62
    /**
63
     * Getter for value
64
     *
65
     * @return int
66
     */
67
    public function getValue()
68
    {
69
        return $this->value;
70
    }
71
72
    /**
73
     * @inheritDoc
74
     *
75
     * @return string
76
     */
77
    public function jsonSerialize()
78
    {
79
        return (float) $this->getValue();
80
    }
81
82
    /**
83
     * Returns string representation
84
     *
85
     * @return string
86
     */
87
    public function __toString()
88
    {
89
        return (string) $this->getValue();
90
    }
91
}
92