1 | 1 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,48 @@ |
1 |
+<?php |
|
2 |
+ |
|
3 |
+namespace Phaxio; |
|
4 |
+ |
|
5 |
+class OperationResult |
|
6 |
+{ |
|
7 |
+ private $message = null; |
|
8 |
+ private $success = false; |
|
9 |
+ private $data = null; |
|
10 |
+ private $paging = null; |
|
11 |
+ |
|
12 |
+ public function __construct($success, $message = null, $data = null, $paging = null) |
|
13 |
+ { |
|
14 |
+ $this->success = $success; |
|
15 |
+ $this->message = $message; |
|
16 |
+ |
|
17 |
+ if ($data !== null) { |
|
18 |
+ $this->data = $data; |
|
19 |
+ } |
|
20 |
+ |
|
21 |
+ if ($paging !== null) { |
|
22 |
+ $this->paging = $paging; |
|
23 |
+ } |
|
24 |
+ } |
|
25 |
+ |
|
26 |
+ public function getPaging(){ |
|
27 |
+ if (!isset($this->paging)){ |
|
28 |
+ throw Exception("This API result has no paging information"); |
|
29 |
+ } |
|
30 |
+ |
|
31 |
+ return $this->paging; |
|
32 |
+ } |
|
33 |
+ |
|
34 |
+ public function succeeded() |
|
35 |
+ { |
|
36 |
+ return $this->success; |
|
37 |
+ } |
|
38 |
+ |
|
39 |
+ public function getData() |
|
40 |
+ { |
|
41 |
+ return $this->data; |
|
42 |
+ } |
|
43 |
+ |
|
44 |
+ public function getMessage() |
|
45 |
+ { |
|
46 |
+ return $this->message; |
|
47 |
+ } |
|
48 |
+} |