Difference::getMethodShortName()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
4
namespace TheCodingMachine\WashingMachine\Clover\Analysis;
5
6
/**
7
 * Represents a difference between 2 methods.
8
 */
9
class Difference
10
{
11
12
    /**
13
     * @var Method
14
     */
15
    private $newMethod;
16
    /**
17
     * @var Method
18
     */
19
    private $oldMethod;
20
21
    public function __construct(Method $newMethod, Method $oldMethod = null)
22
    {
23
        $this->newMethod = $newMethod;
24
        $this->oldMethod = $oldMethod;
25
    }
26
27
    public function getMethodFullName() : string
28
    {
29
        return $this->newMethod->getFullName();
30
    }
31
32
    public function getMethodShortName() : string
33
    {
34
        return $this->newMethod->getShortName();
35
    }
36
37
    public function getCrapScore() : float
38
    {
39
        return $this->newMethod->getCrap();
40
    }
41
42
    public function isNew() : bool
43
    {
44
        return $this->oldMethod === null;
45
    }
46
47
    public function getCrapDifference(): float
48
    {
49
        return $this->newMethod->getCrap() - $this->oldMethod->getCrap();
50
    }
51
52
    public function getFile()
53
    {
54
        return $this->newMethod->getFile();
55
    }
56
57
    public function getLine()
58
    {
59
        return $this->newMethod->getLine();
60
    }
61
}
62