summaryrefslogtreecommitdiff
path: root/src/RequestMessage.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/RequestMessage.php')
-rw-r--r--src/RequestMessage.php40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/RequestMessage.php b/src/RequestMessage.php
new file mode 100644
index 0000000..46dfba3
--- /dev/null
+++ b/src/RequestMessage.php
@@ -0,0 +1,40 @@
+<?php
+
+namespace jobd;
+
+class RequestMessage extends Message {
+
+ protected $requestType;
+ protected $requestData;
+ protected $password;
+
+ /**
+ * Request constructor.
+ * @param string $request_type
+ * @param null $request_data
+ */
+ public function __construct(string $request_type, $request_data = null) {
+ parent::__construct(Message::REQUEST);
+
+ $this->requestData = $request_data;
+ $this->requestType = $request_type;
+ }
+
+ /**
+ * @param string $password
+ */
+ public function setPassword(string $password) {
+ $this->password = $password;
+ }
+
+ /**
+ * @return string[]
+ */
+ public function getContent(): array {
+ $request = ['type' => $this->requestType];
+ if (!is_null($this->requestData))
+ $request['data'] = $this->requestData;
+ return $request;
+ }
+
+} \ No newline at end of file