Completed
Push — master ( dea263...7d2382 )
by Craig
01:29
created

Cursor::right()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
ccs 1
cts 1
cp 1
cc 1
nc 1
nop 1
crap 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 120
    public function up($lines = 1)
15
    {
16 120
        return "\e[{$lines}A";
17
    }
18
19
    /**
20
     * Move the cursor down in the terminal x number of lines.
21
     *
22
     * @param int $lines
23
     *
24
     * @return string
25
     */
26 16
    public function down($lines = 1)
27
    {
28 16
        return "\e[{$lines}B";
29
    }
30
31
    /**
32
     * Move the cursor right in the terminal x number of columns.
33
     *
34
     * @param int $cols
0 ignored issues
show
Bug introduced by
There is no parameter named $cols. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
35
     *
36 120
     * @return string
37
     */
38 120
    public function right($columns = 1)
39
    {
40
        return "\e[{$columns}C";
41
    }
42
43
    /**
44
     * Move the cursor left in the terminal x number of columns.
45
     *
46 104
     * @param int $cols
47
     *
48 104
     * @return string
49
     */
50
    public function left($cols = 1)
51
    {
52
        return "\e[{$cols}D";
53
    }
54
55
    /**
56 16
     * Move cursor to the beginning of the current line.
57
     *
58 16
     * @return string
59
     */
60
    public function startOfCurrentLine()
61
    {
62
        return "\r";
63
    }
64
65
    /**
66 16
     * Delete the current line to the end.
67
     *
68 16
     * @return string
69
     */
70
    public function deleteCurrentLine()
71
    {
72
        return "\e[K";
73
    }
74
75
    /**
76
     * Get the style for hiding the cursor
77
     *
78
     * @return string
79
     */
80
    public function hide()
81
    {
82
        return "\e[?25l";
83
    }
84
85
    /**
86
     * Get the style for returning the cursor to its default
87
     *
88
     * @return string
89
     */
90
    public function defaultStyle()
91
    {
92
        return "\e[?25h";
93
    }
94
}
95