Completed
Pull Request — master (#38)
by Pádraic
02:50
created

FileReport::__construct()   A

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 1
1
<?php
2
3
namespace PHPMND;
4
5
use Symfony\Component\Finder\SplFileInfo;
6
7
/**
8
 * @package PHPMND
9
 */
10
class FileReport
11
{
12
    /**
13
     * @var array
14
     */
15
    private $entries = [];
16
17
    /**
18
     * @var SplFileInfo
19
     */
20
    private $file;
21
22
    /**
23
     * @param SplFileInfo $file
24
     */
25
    public function __construct(SplFileInfo $file)
26
    {
27
        $this->file = $file;
28
    }
29
30
    /**
31
     * @return SplFileInfo
32
     */
33
    public function getFile()
34
    {
35
        return $this->file;
36
    }
37
38
    /**
39
     * @param int $line
40
     * @param int|float $value
41
     */
42
    public function addEntry($line, $value)
43
    {
44
        $this->entries[] = [
45
            'line' => $line,
46
            'value' => $value,
47
        ];
48
    }
49
50
    /**
51
     * @return array
52
     */
53
    public function getEntries()
54
    {
55
        return $this->entries;
56
    }
57
58
    /**
59
     * @return bool
60
     */
61
    public function hasMagicNumbers()
62
    {
63
        return false === empty($this->entries);
64
    }
65
}
66