Completed
Push — version-4-wip ( 86a2b9...5c3ca2 )
by Craig
03:49
created

ClearLine   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 3
dl 0
loc 32
ccs 11
cts 11
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A result() 0 15 2
A sameLine() 0 4 1
1
<?php
2
3
namespace League\CLImate\TerminalObject\Basic;
4
5
final class ClearLine extends Repeatable
6
{
7
    /**
8
     * Clear the lines.
9
     *
10
     * @return string
11
     */
12 8
    public function result()
13
    {
14 8
        $string = "";
15 8
        while ($this->count > 0) {
16 8
            $string .= $this->util->cursor->startOfCurrentLine();
17 8
            $string .= $this->util->cursor->deleteCurrentLine();
18 8
            --$this->count;
19
20 8
            $string .= $this->util->cursor->up();
21
        }
22
23 8
        $string .= $this->util->cursor->down();
24
25 8
        return $string;
26
    }
27
28
29
    /**
30
     * @inheritdoc
31
     */
32 8
    public function sameLine()
33
    {
34 8
        return true;
35
    }
36
}
37