-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from goldspecdigital/develop
implemented response objects (#7)
- Loading branch information
Showing
5 changed files
with
122 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace GoldSpecDigital\VoodooSmsSdk\Responses; | ||
|
||
use DateTime; | ||
|
||
class DeliveryStatusResponse extends Response | ||
{ | ||
/** | ||
* @return int | ||
*/ | ||
public function getResult(): int | ||
{ | ||
return (int)$this->response['result']; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getReferenceId(): string | ||
{ | ||
return $this->response['reference_id']; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getMessage(): string | ||
{ | ||
return $this->response['message']; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getDeliveryStatus(): string | ||
{ | ||
return $this->response['delivery_status']; | ||
} | ||
|
||
/** | ||
* @return \DateTime | ||
*/ | ||
public function getDeliveryDateTime(): DateTime | ||
{ | ||
return new DateTime($this->response['delivery_datetime']); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace GoldSpecDigital\VoodooSmsSdk\Responses; | ||
|
||
abstract class Response | ||
{ | ||
/** | ||
* @var array | ||
*/ | ||
protected $response; | ||
|
||
/** | ||
* SendSmsResponse constructor. | ||
* | ||
* @param array $response | ||
*/ | ||
public function __construct(array $response) | ||
{ | ||
$this->response = $response; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace GoldSpecDigital\VoodooSmsSdk\Responses; | ||
|
||
class SendSmsResponse extends Response | ||
{ | ||
/** | ||
* @return int | ||
*/ | ||
public function getResult(): int | ||
{ | ||
return (int)$this->response['result']; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getResultText(): string | ||
{ | ||
return $this->response['resultText']; | ||
} | ||
|
||
/** | ||
* @return array | ||
*/ | ||
public function getReferenceId(): array | ||
{ | ||
return $this->response['reference_id']; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters