Cursor   A
last analyzed

Coupling/Cohesion

Components 0
Dependencies 0

Complexity

Total Complexity 6

Size/Duplication

Total Lines 66
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 6
lcom 0
cbo 0
dl 0
loc 66
ccs 12
cts 12
cp 1
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A startOfCurrentLine() 0 4 1
A deleteCurrentLine() 0 4 1
A up() 0 4 1
A left() 0 4 1
A hide() 0 4 1
A defaultStyle() 0 4 1
1
<?php
2
3
namespace League\CLImate\Util;
4
5
class Cursor
6
{
7
    /**
8
     * Move the cursor up in the terminal x number of lines.
9
     *
10
     * @param int $lines
11
     *
12
     * @return string
13
     */
14 116
    public function up($lines = 1)
15
    {
16 116
        return "\e[{$lines}A";
17
    }
18
19
    /**
20
     * Move the cursor left in the terminal x number of columns.
21
     *
22
     * @param int $cols
23
     *
24
     * @return string
25
     */
26 16
    public function left($cols = 1)
27
    {
28 16
        return "\e[{$cols}D";
29
    }
30
31
    /**
32
     * Move cursor to the beginning of the current line.
33
     *
34
     * @return string
35
     */
36 116
    public function startOfCurrentLine()
37
    {
38 116
        return "\r";
39
    }
40
41
    /**
42
     * Delete the current line to the end.
43
     *
44
     * @return string
45
     */
46 100
    public function deleteCurrentLine()
47
    {
48 100
        return "\e[K";
49
    }
50
51
    /**
52
     * Get the style for hiding the cursor
53
     *
54
     * @return string
55
     */
56 16
    public function hide()
57
    {
58 16
        return "\e[?25l";
59
    }
60
61
    /**
62
     * Get the style for returning the cursor to its default
63
     *
64
     * @return string
65
     */
66 16
    public function defaultStyle()
67
    {
68 16
        return "\e[?25h";
69
    }
70
}
71