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

Flash::display()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 22
Code Lines 15

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 22
rs 9.2
c 1
b 0
f 0
cc 1
eloc 15
nc 1
nop 0
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