1 | <?php |
||
13 | abstract class Dialogue |
||
14 | { |
||
15 | /** |
||
16 | * @var MenuStyle |
||
17 | */ |
||
18 | protected $style; |
||
19 | |||
20 | /** |
||
21 | * @var CliMenu |
||
22 | */ |
||
23 | protected $parentMenu; |
||
24 | |||
25 | /** |
||
26 | * @var TerminalInterface |
||
27 | */ |
||
28 | protected $terminal; |
||
29 | |||
30 | /** |
||
31 | * @var string $text |
||
32 | */ |
||
33 | protected $text; |
||
34 | |||
35 | /** |
||
36 | * @var int |
||
37 | */ |
||
38 | protected $x; |
||
39 | |||
40 | /** |
||
41 | * @var int |
||
42 | */ |
||
43 | protected $y; |
||
44 | |||
45 | /** |
||
46 | * @param CliMenu $parentMenu |
||
47 | * @param MenuStyle $menuStyle |
||
48 | * @param TerminalInterface $terminal |
||
49 | * @param string $text |
||
50 | */ |
||
51 | public function __construct(CliMenu $parentMenu, MenuStyle $menuStyle, TerminalInterface $terminal, $text) |
||
60 | |||
61 | /** |
||
62 | * @throws MenuNotOpenException |
||
63 | */ |
||
64 | protected function assertMenuOpen() |
||
70 | |||
71 | /** |
||
72 | * Calculate the co-ordinates to write the messages |
||
73 | */ |
||
74 | protected function calculateCoordinates() |
||
86 | |||
87 | /** |
||
88 | * Write an empty row |
||
89 | */ |
||
90 | protected function emptyRow() |
||
103 | |||
104 | /** |
||
105 | * Write some text at a particular column |
||
106 | * |
||
107 | * @param int $column |
||
108 | * @param string $text |
||
109 | */ |
||
110 | protected function write($text, $column = null) |
||
115 | |||
116 | /** |
||
117 | * @return MenuStyle |
||
118 | */ |
||
119 | public function getStyle() |
||
123 | } |
||
124 |
This check looks for assignments to scalar types that may be of the wrong type.
To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.