Remove unnecessary conditional when creating keyboard from params.

parent ce42f431
......@@ -91,25 +91,17 @@ class Keyboard extends Entity
if (!array_key_exists($keyboard_type, (array)$data)) {
$new_keyboard = [];
foreach ($args as $row) {
if (is_array($row)) {
$new_row = [];
if ($button_class::couldBe($row)) {
$new_row[] = new $button_class($row);
} else {
foreach ($row as $button) {
if ($button instanceof $button_class) {
$new_row[] = $button;
} elseif (!$this->isInlineKeyboard() || $button_class::couldBe($button)) {
$new_row[] = new $button_class($button);
}
}
}
$new_row = [];
if ($button_class::couldBe($row)) {
$new_row[] = new $button_class($row);
} else {
$button = $row;
if (!($button instanceof $button_class)) {
$button = new $button_class($button);
foreach ($row as $button) {
if ($button instanceof $button_class) {
$new_row[] = $button;
} elseif (!$this->isInlineKeyboard() || $button_class::couldBe($button)) {
$new_row[] = new $button_class($button);
}
}
$new_row = [$button];
}
$new_keyboard[] = $new_row;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment