Bookable
2 years ago
Booking
1 year ago
Entities
1 year ago
Import
2 years ago
Notification
1 year ago
Payment
1 year ago
Settings
1 year ago
Square
1 year ago
Stash
4 years ago
Stats
2 years ago
Test
2 years ago
User
1 year ago
WhatsNew
2 years ago
Command.php
1 year ago
CommandHandler.php
7 years ago
CommandResult.php
6 years ago
CommandResult.php
141 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Class for standardizing command results |
| 4 | */ |
| 5 | |
| 6 | namespace AmeliaBooking\Application\Commands; |
| 7 | |
| 8 | /** |
| 9 | * Class CommandResult |
| 10 | * |
| 11 | * @package AmeliaBooking\Application\Commands |
| 12 | */ |
| 13 | class CommandResult |
| 14 | { |
| 15 | const RESULT_SUCCESS = 'success'; |
| 16 | const RESULT_ERROR = 'error'; |
| 17 | const RESULT_CONFLICT = 'conflict'; |
| 18 | |
| 19 | private $data; |
| 20 | private $message; |
| 21 | |
| 22 | private $result = self::RESULT_SUCCESS; |
| 23 | |
| 24 | private $attachment = false; |
| 25 | private $file = null; |
| 26 | private $url; |
| 27 | private $dataInResponse = true; |
| 28 | |
| 29 | /** |
| 30 | * @return string |
| 31 | */ |
| 32 | public function getResult() |
| 33 | { |
| 34 | return $this->result; |
| 35 | } |
| 36 | |
| 37 | /** |
| 38 | * @param string $result |
| 39 | */ |
| 40 | public function setResult($result) |
| 41 | { |
| 42 | $this->result = $result; |
| 43 | } |
| 44 | |
| 45 | /** |
| 46 | * @return mixed |
| 47 | */ |
| 48 | public function getData() |
| 49 | { |
| 50 | return $this->data; |
| 51 | } |
| 52 | |
| 53 | /** |
| 54 | * @param mixed $data |
| 55 | */ |
| 56 | public function setData($data) |
| 57 | { |
| 58 | $this->data = $data; |
| 59 | } |
| 60 | |
| 61 | /** |
| 62 | * @return mixed |
| 63 | */ |
| 64 | public function getMessage() |
| 65 | { |
| 66 | return $this->message; |
| 67 | } |
| 68 | |
| 69 | /** |
| 70 | * @param mixed $message |
| 71 | */ |
| 72 | public function setMessage($message) |
| 73 | { |
| 74 | $this->message = $message; |
| 75 | } |
| 76 | |
| 77 | /** |
| 78 | * @return mixed |
| 79 | */ |
| 80 | public function hasAttachment() |
| 81 | { |
| 82 | return $this->attachment; |
| 83 | } |
| 84 | |
| 85 | /** |
| 86 | * @param mixed $attachment |
| 87 | */ |
| 88 | public function setAttachment($attachment) |
| 89 | { |
| 90 | $this->attachment = $attachment; |
| 91 | } |
| 92 | |
| 93 | /** |
| 94 | * @return mixed |
| 95 | */ |
| 96 | public function getUrl() |
| 97 | { |
| 98 | return $this->url; |
| 99 | } |
| 100 | |
| 101 | /** |
| 102 | * @param mixed $url |
| 103 | */ |
| 104 | public function setUrl($url) |
| 105 | { |
| 106 | $this->url = $url; |
| 107 | } |
| 108 | |
| 109 | /** |
| 110 | * @param mixed $file |
| 111 | */ |
| 112 | public function setFile($file) |
| 113 | { |
| 114 | $this->file = $file; |
| 115 | } |
| 116 | |
| 117 | /** |
| 118 | * @return mixed |
| 119 | */ |
| 120 | public function getFile() |
| 121 | { |
| 122 | return $this->file; |
| 123 | } |
| 124 | |
| 125 | /** |
| 126 | * @return mixed |
| 127 | */ |
| 128 | public function hasDataInResponse() |
| 129 | { |
| 130 | return $this->dataInResponse; |
| 131 | } |
| 132 | |
| 133 | /** |
| 134 | * @param mixed $dataInResponse |
| 135 | */ |
| 136 | public function setDataInResponse($dataInResponse) |
| 137 | { |
| 138 | $this->dataInResponse = $dataInResponse; |
| 139 | } |
| 140 | } |
| 141 |