summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorHannes Kindströmmer <hannes@kindstrommer.se>2017-02-28 10:59:16 +0100
committerHannes Kindströmmer <hannes@kindstrommer.se>2017-02-28 10:59:16 +0100
commit84d1a92170a00ff517ddd77b5ad987aac60862e8 (patch)
treef16acbf793949eaccf7dae5580482ddc7bebbe76 /src
parente41db01edb5b022096a0a9fc5f09c13fec80cc69 (diff)
downloadip1-php-sdk-84d1a92170a00ff517ddd77b5ad987aac60862e8.zip
ip1-php-sdk-84d1a92170a00ff517ddd77b5ad987aac60862e8.tar.gz
ip1-php-sdk-84d1a92170a00ff517ddd77b5ad987aac60862e8.tar.bz2
toJson -> toStdClass
Diffstat (limited to 'src')
-rw-r--r--src/Core/Component.php2
-rw-r--r--src/SMS/LoggedOutGoingSMS.php12
-rw-r--r--src/SMS/OutGoingSMS.php11
-rw-r--r--src/SMS/ProcessedOutGoingSMS.php17
-rw-r--r--src/SMS/SMS.php8
5 files changed, 45 insertions, 5 deletions
diff --git a/src/Core/Component.php b/src/Core/Component.php
index d2fee3a..2923047 100644
--- a/src/Core/Component.php
+++ b/src/Core/Component.php
@@ -4,5 +4,5 @@ namespace \IP1\RESTClient\Core;
interface Component
{
- public function toJson(int $styleArg = 0): string;
+ public function toStdClass(): stdClass;
}
diff --git a/src/SMS/LoggedOutGoingSMS.php b/src/SMS/LoggedOutGoingSMS.php
index c013f17..7bbba95 100644
--- a/src/SMS/LoggedOutGoingSMS.php
+++ b/src/SMS/LoggedOutGoingSMS.php
@@ -4,6 +4,7 @@ namespace \IP1\RESTClient\SMS;
class LoggedOutGoingSMS extends ProcessedOutGoingSMS implements UpdatableComponent
{
private $updated;
+ private $created;
const IS_READ_ONLY = true;
@@ -15,4 +16,15 @@ class LoggedOutGoingSMS extends ProcessedOutGoingSMS implements UpdatableCompone
{
return $this->updated;
}
+ public function getCreated(): DateTime
+ {
+ return $this->created;
+ }
+ public function toStdClass(): stdClass
+ {
+ $returnObject = parent::toStdClass();
+ $returnObject->UpdatedDate = $this->updated;
+ $returnObject->CreatedDate = $this->created;
+ return $returnObject;
+ }
}
diff --git a/src/SMS/OutGoingSMS.php b/src/SMS/OutGoingSMS.php
index 326d919..1220f1e 100644
--- a/src/SMS/OutGoingSMS.php
+++ b/src/SMS/OutGoingSMS.php
@@ -1,8 +1,10 @@
<?php
+use \IP1\RESTClient\Recipient\Contact;
+use \IP1\RESTClient\Recipient\Group;
namespace \IP1\RESTClient\SMS;
-class OutGoingSMS extends SMS
+class OutGoingSMS extends SMS implements \IP1\RESTClient\Core\Component
{
private $numbers = [];
private $contacts = [];
@@ -22,9 +24,10 @@ class OutGoingSMS extends SMS
$this->groups[] = $group;
}
- public function toJson(int $styleArg = 0): string
+ public function toStdClass(): stdClass
{
- $returnObject = new \stdClass();
+ $returnObject = parent::toStdClass();
+ $returnObject->Email = $this->email;
if (count($this->numbers) > 0) {
$returnObject->Numbers = $this->numbers;
}
@@ -40,6 +43,6 @@ class OutGoingSMS extends SMS
$returnObject->Groups[] = $group->getID();
}
}
- return json_encode($returnObject, $styleArg);
+ return $returnObject;
}
}
diff --git a/src/SMS/ProcessedOutGoingSMS.php b/src/SMS/ProcessedOutGoingSMS.php
index 8092f06..d41eba4 100644
--- a/src/SMS/ProcessedOutGoingSMS.php
+++ b/src/SMS/ProcessedOutGoingSMS.php
@@ -26,4 +26,21 @@ class ProcessedOutGoingSMS extends OutGoingSMS
{
return $this->recipient;
}
+ public function toStdClass(): stdClass
+ {
+ $returnObject = parent::toStdClass();
+ if (!empty($this->bundleID)) {
+ $returnObject->BundleID = $this->bundleID;
+ }
+ if (!empty($this->status)) {
+ $returnObject->Status = $this->status;
+ }
+ if (!empty($this->statusDescription)) {
+ $returnObject->StatusDescription = $this->statusDescription;
+ }
+ if (!empty($this->recipient)) {
+ $returnObject->Recipient = $this->recipient;
+ }
+ return $returnObject;
+ }
}
diff --git a/src/SMS/SMS.php b/src/SMS/SMS.php
index 3c270eb..d2b0faf 100644
--- a/src/SMS/SMS.php
+++ b/src/SMS/SMS.php
@@ -23,4 +23,12 @@ abstract class SMS implements Component
{
$this->prio = $priority;
}
+ public function toStdClass(): stdClass
+ {
+ $returnObject = new \stdClass();
+ $returnObject->Prio = $this->prio;
+ $returnObject->From = $this->from;
+ $returnObject->Message = $this->message;
+ return $returnObject;
+ }
}