Skip to content

Commit f36a853

Browse files
committed
add constructors
1 parent 8635217 commit f36a853

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

src/Api/Type/Keyboard/KeyboardButton.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,16 @@ final class KeyboardButton
4545
* @var bool
4646
*/
4747
public $requestLocation = false;
48+
49+
/**
50+
* @param string $text
51+
* @param bool $requestContact
52+
* @param bool $requestLocation
53+
*/
54+
public function __construct(string $text, bool $requestContact = false, bool $requestLocation = false)
55+
{
56+
$this->text = $text;
57+
$this->requestContact = $requestContact;
58+
$this->requestLocation = $requestLocation;
59+
}
4860
}

src/Api/Type/Keyboard/ReplyKeyboardMarkup.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,23 @@ final class ReplyKeyboardMarkup implements ReplayMarkup
6060
* @var bool
6161
*/
6262
public $selective = false;
63+
64+
public static function withButtons(KeyboardButton ...$buttons): self
65+
{
66+
return new self($buttons);
67+
}
68+
69+
/**
70+
* @param KeyboardButton[] $keyboard
71+
* @param bool $resizeKeyboard
72+
* @param bool $oneTimeKeyboard
73+
* @param bool $selective
74+
*/
75+
public function __construct(array $keyboard, bool $resizeKeyboard = false, bool $oneTimeKeyboard = false, bool $selective = false)
76+
{
77+
$this->keyboard = $keyboard;
78+
$this->resizeKeyboard = $resizeKeyboard;
79+
$this->oneTimeKeyboard = $oneTimeKeyboard;
80+
$this->selective = $selective;
81+
}
6382
}

0 commit comments

Comments
 (0)