@@ -10,9 +10,9 @@ abstract class KeyboardMarkup extends FluentEntity
10
10
*
11
11
* @var string
12
12
*/
13
- protected static $ keyboardFieldName = 'keyboard ' ;
13
+ protected static string $ keyboardFieldName = 'keyboard ' ;
14
14
15
- protected $ currentRowIndex = 0 ;
15
+ protected int $ currentRowIndex = 0 ;
16
16
17
17
public function __construct (array $ data = [])
18
18
{
@@ -32,13 +32,13 @@ public function row(array $buttons = []): self
32
32
{
33
33
$ keyboard = &$ this ->data [static ::$ keyboardFieldName ];
34
34
35
- // Last row is not empty
35
+ // Last row is not empty, add new row
36
36
if (! empty ($ keyboard [$ this ->currentRowIndex ])) {
37
37
$ keyboard [] = [];
38
38
$ this ->currentRowIndex ++;
39
39
}
40
40
41
- // argument is not empty
41
+ // Buttons have been passed, add them
42
42
if (! empty ($ buttons )) {
43
43
$ keyboard [$ this ->currentRowIndex ] = $ buttons ;
44
44
$ this ->currentRowIndex ++;
@@ -48,14 +48,13 @@ public function row(array $buttons = []): self
48
48
}
49
49
50
50
/**
51
- * Adds buttons one per row to the keyboard.
51
+ * Adds buttons to the keyboard, one per row .
52
52
*
53
53
* @param Button[] $buttons
54
54
* @return $this
55
55
*/
56
56
public function stack (array $ buttons ): self
57
57
{
58
- // Every button gets its own row
59
58
foreach ($ buttons as $ button ) {
60
59
$ this ->row ([$ button ]);
61
60
}
0 commit comments