Completed
Push — master ( c7bdb1...5472d7 )
by Aydin
04:34
created

Flash   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
lcom 1
cbo 4
dl 0
loc 29
rs 10
c 1
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A display() 0 22 1
1
<?php
2
3
namespace PhpSchool\CliMenu\Dialogue;
4
5
/**
6
 * @author Aydin Hassan <[email protected]>
7
 */
8
class Flash extends Dialogue
9
{
10
    /**
11
     * Flash a message on top of the menu which
12
     * disappears on any keystroke.
13
     */
14
    public function display()
15
    {
16
        $this->assertMenuOpen();
17
18
        $this->terminal->moveCursorToRow($this->y);
19
20
        $this->emptyRow();
21
22
        $this->write(sprintf(
23
            "%s%s%s%s%s\n",
24
            $this->style->getUnselectedSetCode(),
25
            str_repeat(' ', $this->style->getPadding()),
26
            $this->text,
27
            str_repeat(' ', $this->style->getPadding()),
28
            $this->style->getUnselectedUnsetCode()
29
        ));
30
31
        $this->emptyRow();
32
        $this->terminal->moveCursorToTop();
33
        $this->terminal->getKeyedInput();
34
        $this->parentMenu->redraw();
35
    }
36
}
37