1 | <?php |
||
16 | class Terminal implements TerminalInterface |
||
17 | { |
||
18 | /** @var CursorInterface */ |
||
19 | protected $cursor; |
||
20 | /** @var DimensionsInterface */ |
||
21 | private $dimensions; |
||
22 | |||
23 | /** |
||
24 | * Terminal will provide cursor and dimension information to the outputter |
||
25 | * |
||
26 | * @param CursorInterface|null $cursor |
||
27 | * @param DimensionsInterface $dimensions |
||
28 | */ |
||
29 | public function __construct(CursorInterface $cursor = null, DimensionsInterface $dimensions = null) |
||
34 | |||
35 | /** |
||
36 | * @return int |
||
37 | */ |
||
38 | public function getWidth() |
||
42 | |||
43 | /** |
||
44 | * @return int |
||
45 | */ |
||
46 | public function getHeight() |
||
50 | |||
51 | /** |
||
52 | * Move the cursor to y,x |
||
53 | * |
||
54 | * @param int $line |
||
55 | * @param int $column |
||
56 | * |
||
57 | * @return string |
||
58 | */ |
||
59 | public function move($line, $column) |
||
63 | |||
64 | /** |
||
65 | * Move up n Lines |
||
66 | * |
||
67 | * @param int $lines |
||
68 | * |
||
69 | * @return string |
||
70 | */ |
||
71 | public function moveUp($lines) |
||
75 | |||
76 | /** |
||
77 | * Move down n Lines |
||
78 | * |
||
79 | * @param int $lines |
||
80 | * |
||
81 | * @return string |
||
82 | */ |
||
83 | public function moveDown($lines) |
||
87 | |||
88 | /** |
||
89 | * Move left n Columns |
||
90 | * |
||
91 | * @param int $columns |
||
92 | * |
||
93 | * @return string |
||
94 | */ |
||
95 | public function moveLeft($columns) |
||
99 | |||
100 | /** |
||
101 | * Move right n Columns |
||
102 | * |
||
103 | * @param int $columns |
||
104 | * |
||
105 | * @return string |
||
106 | */ |
||
107 | public function moveRight($columns) |
||
111 | |||
112 | /** |
||
113 | * Erase to the end of the line |
||
114 | * |
||
115 | * @return string |
||
116 | */ |
||
117 | public function eraseToEnd() |
||
121 | |||
122 | /** |
||
123 | * Erase to the start of the line |
||
124 | * |
||
125 | * @return string |
||
126 | */ |
||
127 | public function eraseToStart() |
||
131 | |||
132 | /** |
||
133 | * Erase Down |
||
134 | * |
||
135 | * @return string |
||
136 | */ |
||
137 | public function eraseDown() |
||
141 | |||
142 | /** |
||
143 | * Erase Up |
||
144 | * |
||
145 | * @return string |
||
146 | */ |
||
147 | public function eraseUp() |
||
151 | |||
152 | /** |
||
153 | * Erase entire screen |
||
154 | * |
||
155 | * @return string |
||
156 | */ |
||
157 | public function eraseScreen() |
||
161 | |||
162 | /** |
||
163 | * Filter takes a string with Cursor movements and filters them out |
||
164 | * |
||
165 | * @param string $string |
||
166 | * |
||
167 | * @return string |
||
168 | */ |
||
169 | public function filter($string) |
||
173 | } |
||
174 |