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