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.

Height   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 33
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
c 0
b 0
f 0
lcom 1
cbo 2
dl 33
loc 33
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A fromHeight() 7 7 1
A pixels() 7 7 1

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
 * PHP Exif Height 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
/**
16
 * Height class
17
 *
18
 * A value object to describe the Height data
19
 *
20
 * @category    PHPExif
21
 * @package     Common
22
 */
23 View Code Duplication
class Height extends MeasuredObject
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...
24
{
25
    /**
26
     * Creates a new instance from given Height object
27
     *
28
     * @param Height $height
29
     *
30
     * @return Height
31
     */
32
    public static function fromHeight(Height $height)
33
    {
34
        return new self(
35
            $height->getValue(),
36
            (clone $height->getUnit())
37
        );
38
    }
39
40
    /**
41
     * Creates new instance from given value and
42
     * adds a "px" Unit
43
     *
44
     * @param mixed $value
45
     *
46
     * @return Height
47
     */
48
    public static function pixels($value)
49
    {
50
        return new self(
51
            $value,
52
            new Unit('px')
53
        );
54
    }
55
}
56