Passed
Push — master ( 67d0bb...8d9edc )
by Alec
02:45
created

Cursor::up()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
ccs 0
cts 2
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php declare(strict_types=1);
2
3
namespace AlecRabbit\Control;
4
5
use AlecRabbit\ConsoleColour\ConsoleColor;
6
7
class Cursor
8
{
9
    /**
10
     * Show cursor sequence
11
     *
12
     * @return string
13
     */
14 1
    public static function show(): string
15
    {
16 1
        return ConsoleColor::ESC_CHAR . '[?25h' . ConsoleColor::ESC_CHAR . '[?0c';
17
    }
18
19
    /**
20
     * Hide cursor sequence
21
     *
22
     * @return string
23
     */
24 1
    public static function hide(): string
25
    {
26 1
        return ConsoleColor::ESC_CHAR . '[?25l';
27
    }
28
29
    /**
30
     * Move up cursor sequence
31
     *
32
     * @param int $rows
33
     * @return string
34
     */
35
    public static function up(int $rows = 1): string
36
    {
37
        return ConsoleColor::ESC_CHAR .  "[{$rows}A";
38
    }
39
40
    /**
41
     * Move down cursor sequence
42
     *
43
     * @param int $rows
44
     * @return string
45
     */
46
    public static function down(int $rows = 1): string
47
    {
48
        return ConsoleColor::ESC_CHAR .  "[{$rows}B";
49
    }
50
}
51