Skip to content

Commit 54719cb

Browse files
committed
Use Laravel helper to determine if value is blank.
1 parent 422d5b2 commit 54719cb

File tree

1 file changed

+5
-17
lines changed

1 file changed

+5
-17
lines changed

src/Components/Button.php

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public function __construct(string $title = '', $data = null, string $type = But
6262
*/
6363
public function title(string $title): self
6464
{
65-
if ($this->isNotSetOrEmpty($title)) {
65+
if (blank($title)) {
6666
throw CouldNotCreateButton::titleNotProvided();
6767
}
6868

@@ -85,7 +85,7 @@ public function title(string $title): self
8585
*/
8686
public function url(string $url): self
8787
{
88-
if ($this->isNotSetOrEmpty($url)) {
88+
if (blank($url)) {
8989
throw CouldNotCreateButton::urlNotProvided();
9090
}
9191

@@ -107,7 +107,7 @@ public function url(string $url): self
107107
*/
108108
public function phone(string $phone): self
109109
{
110-
if ($this->isNotSetOrEmpty($phone)) {
110+
if (blank($phone)) {
111111
throw CouldNotCreateButton::phoneNumberNotProvided();
112112
}
113113

@@ -129,7 +129,7 @@ public function phone(string $phone): self
129129
*/
130130
public function postback(array $postback): self
131131
{
132-
if ($this->isNotSetOrEmpty($postback)) {
132+
if (blank($postback)) {
133133
throw CouldNotCreateButton::postbackNotProvided();
134134
}
135135

@@ -211,7 +211,7 @@ protected function isType(string $type): bool
211211
*/
212212
protected function makePayload($data): self
213213
{
214-
if ($this->isNotSetOrEmpty($data)) {
214+
if (blank($data)) {
215215
return $this;
216216
}
217217

@@ -258,16 +258,4 @@ public function jsonSerialize()
258258
{
259259
return $this->toArray();
260260
}
261-
262-
/**
263-
* Determine if it's not set or is empty.
264-
*
265-
* @param $var
266-
*
267-
* @return bool
268-
*/
269-
protected function isNotSetOrEmpty($var): bool
270-
{
271-
return !isset($var) || empty($var);
272-
}
273261
}

0 commit comments

Comments
 (0)