UseStatementBlock   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 67
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 1
Metric Value
wmc 6
c 2
b 0
f 1
lcom 1
cbo 0
dl 0
loc 67
ccs 10
cts 10
cp 1
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A addStatement() 0 7 1
A getStatements() 0 4 1
A getSortedStatements() 0 6 1
A getLineNumbers() 0 4 1
A getSortedLineNumbers() 0 6 1
A count() 0 4 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