From 2237970041417ef39c22e3dcd414ea2afe35a35d Mon Sep 17 00:00:00 2001 From: zkwbbr <45949485+zkwbbr@users.noreply.github.com> Date: Wed, 30 Aug 2023 17:26:30 +0800 Subject: [PATCH] Add method chaining to setter methods Add method chaining to setter methods to allow use to fluent interface. For example: $pushover = (new \Pushover) ->setTitle('hello') ->setMessage('world'); --- Pushover.php | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/Pushover.php b/Pushover.php index cc49e99..fd99871 100644 --- a/Pushover.php +++ b/Pushover.php @@ -150,6 +150,8 @@ public function __construct () { */ public function setToken ($token) { $this->_token = (string)$token; + + return $this; } /** @@ -170,6 +172,8 @@ public function getToken () { */ public function setUser ($user) { $this->_user = (string)$user; + + return $this; } /** @@ -213,6 +217,8 @@ public function getUser () { */ public function setTitle ($title) { $this->_title = (string)$title; + + return $this; } /** @@ -233,6 +239,8 @@ public function getTitle () { */ public function setHtml ($html) { $this->_html = (int)$html; + + return $this; } /** @@ -251,6 +259,8 @@ public function getHtml () { */ public function setRetry ($retry) { $this->_retry = (int)$retry; + + return $this; } /** @@ -269,6 +279,8 @@ public function getRetry() { */ public function setExpire ($expire) { $this->_expire = (int)$expire; + + return $this; } /** @@ -287,6 +299,8 @@ public function getExpire () { */ public function setCallback ($callback) { $this->_callback = $callback; + + return $this; } /** @@ -307,6 +321,8 @@ public function getCallback() { */ public function setMessage ($msg) { $this->_message = (string)$msg; + + return $this; } /** @@ -327,6 +343,8 @@ public function getMessage () { */ public function setDevice ($device) { $this->_device = (string)$device; + + return $this; } /** @@ -349,6 +367,8 @@ public function getDevice () { */ public function setTimestamp ($time) { $this->_timestamp = (int)$time; + + return $this; } /** @@ -374,6 +394,8 @@ public function getTimestamp () { */ public function setPriority ($priority) { $this->_priority = (int)$priority; + + return $this; } /** @@ -394,6 +416,8 @@ public function getPriority () { */ public function setUrl ($url) { $this->_url = (string)$url; + + return $this; } /** @@ -414,6 +438,8 @@ public function getUrl () { */ public function setUrlTitle ($url_title) { $this->_url_title = (string)$url_title; + + return $this; } /** @@ -434,6 +460,8 @@ public function getUrlTitle () { */ public function setReceipt ($receipt) { $this->_receipt = (string)$receipt; + + return $this; } /** @@ -454,6 +482,8 @@ public function getReceipt () { */ public function setDebug ($debug) { $this->_debug = (boolean)$debug; + + return $this; } /** @@ -474,6 +504,8 @@ public function getDebug () { */ public function setSound ($sound) { $this->_sound = (string)$sound; + + return $this; } /**