UseStatementBlock::getStatements()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 4
ccs 1
cts 1
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
3
namespace Matks\PHPMakeUp\UseSorting;
4
5
class UseStatementBlock
6
{
7
    /**
8
     * @var UseStatement[]
9
     */
10
    private $statements = array();
11
12
    /**
13
     * @var int[]
14
     */
15
    private $lineNumbers = array();
16
17
    /**
18
     * @param int    $lineNumber
19
     * @param string $statementContent
20
     *
21
     * @return $this
22
     */
23
    public function addStatement($lineNumber, $statementContent)
24
    {
25 1
        $this->statements[$lineNumber] = $statementContent;
26 1
        $this->lineNumbers[]           = $lineNumber;
27
28 1
        return $this;
29
    }
30
31
    /**
32
     * @return UseStatement[]
33
     */
34
    public function getStatements()
35
    {
36 1
        return $this->statements;
37
    }
38
39
    public function getSortedStatements()
40
    {
41 1
        sort($this->statements, SORT_STRING);
42
43 1
        return $this->statements;
44
    }
45
46
    /**
47
     * @return int[]
48
     */
49
    public function getLineNumbers()
50
    {
51 1
        return $this->lineNumbers;
52
    }
53
54
    /**
55
     * @return int[]
56
     */
57
    public function getSortedLineNumbers()
58
    {
59 1
        sort($this->lineNumbers);
60
61 1
        return $this->lineNumbers;
62
    }
63
64
    /**
65
     * @return int
66
     */
67
    public function count()
68
    {
69 1
        return count($this->statements);
70
    }
71
}
72