1 | <?php |
||
11 | class AsciiArtItem implements MenuItemInterface |
||
12 | { |
||
13 | /** |
||
14 | * Possible positions of the ascii art |
||
15 | */ |
||
16 | const POSITION_CENTER = 'center'; |
||
17 | const POSITION_LEFT = 'left'; |
||
18 | const POSITION_RIGHT = 'right'; |
||
19 | |||
20 | /** |
||
21 | * @var string |
||
22 | */ |
||
23 | private $text; |
||
24 | |||
25 | /** |
||
26 | * @var string |
||
27 | */ |
||
28 | private $position; |
||
29 | |||
30 | /** |
||
31 | * @var int |
||
32 | */ |
||
33 | private $artLength; |
||
34 | |||
35 | /** |
||
36 | * @var int |
||
37 | */ |
||
38 | private $numberOfRows = 0; |
||
39 | |||
40 | /** |
||
41 | * @var int |
||
42 | */ |
||
43 | private $startRowNumber = 0; |
||
44 | |||
45 | public function __construct(string $text, string $position = self::POSITION_CENTER) |
||
53 | |||
54 | /** |
||
55 | * Returns the number of terminal rows the item takes |
||
56 | */ |
||
57 | public function getNumberOfRows() : int |
||
61 | |||
62 | /** |
||
63 | * Sets the row number the item starts at in the frame |
||
64 | */ |
||
65 | public function setStartRowNumber(int $rowNumber) : void |
||
69 | |||
70 | /** |
||
71 | * Returns the row number the item starts at in the frame |
||
72 | */ |
||
73 | public function getStartRowNumber() : int |
||
77 | |||
78 | /** |
||
79 | * The output text for the item |
||
80 | */ |
||
81 | public function getRows(MenuStyle $style, bool $selected = false) : array |
||
114 | |||
115 | /** |
||
116 | * Can the item be selected |
||
117 | */ |
||
118 | public function canSelect() : bool |
||
122 | |||
123 | /** |
||
124 | * Execute the items callable if required |
||
125 | */ |
||
126 | public function getSelectAction() : ?callable |
||
130 | |||
131 | /** |
||
132 | * Return the raw string of text |
||
133 | */ |
||
134 | public function getText() : string |
||
138 | |||
139 | /** |
||
140 | * Return the length of the art |
||
141 | */ |
||
142 | public function getArtLength() : int |
||
146 | |||
147 | /** |
||
148 | * Whether or not the menu item is showing the menustyle extra value |
||
149 | */ |
||
150 | public function showsItemExtra() : bool |
||
154 | |||
155 | /** |
||
156 | * Enable showing item extra |
||
157 | */ |
||
158 | public function showItemExtra() : void |
||
162 | |||
163 | /** |
||
164 | * Disable showing item extra |
||
165 | */ |
||
166 | public function hideItemExtra() : void |
||
170 | } |
||
171 |
The break statement is not necessary if it is preceded for example by a return statement:
If you would like to keep this construct to be consistent with other case statements, you can safely mark this issue as a false-positive.