Completed
Push — master ( 1f068c...5f1967 )
by Дмитрий
05:07
created

IssueLocation::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 2
dl 0
loc 5
ccs 4
cts 4
cp 1
crap 1
rs 9.4285
c 0
b 0
f 0
1
<?php
2
/**
3
 * @author Patsura Dmitry https://github.com/ovr <[email protected]>
4
 */
5
6
namespace PHPSA;
7
8
class IssueLocation
9
{
10
    /**
11
     * @var string
12
     */
13
    protected $filePath;
14
15
    /**
16
     * @var int
17
     */
18
    protected $lineStart;
19
20
    /**
21
     * @param string $filePath
22
     * @param int $lineStart
23
     */
24 38
    public function __construct($filePath, $lineStart)
25
    {
26 38
        $this->filePath = $filePath;
27 38
        $this->lineStart = $lineStart;
28 38
    }
29
30
    /**
31
     * Get path to the file + filename
32
     *
33
     * @return string
34
     */
35
    public function getFilePath()
36
    {
37
        return $this->filePath;
38
    }
39
40
    /**
41
     * @return string
42
     */
43 38
    public function getFileName()
44
    {
45 38
        return basename($this->filePath);
46
    }
47
48
    /**
49
     * @return array
50
     */
51
    public function toArray()
52
    {
53
        return [
54
            'path' => $this->filePath,
55
            'lines' => [
56
                'begin' => $this->lineStart,
57
                'end' => $this->lineStart,
58
            ]
59
        ];
60
    }
61
62
    /**
63
     * @return int
64
     */
65 38
    public function getLineStart()
66
    {
67 38
        return $this->lineStart;
68
    }
69
}
70