| @@ 17-66 (lines=50) @@ | ||
| 14 | /** |
|
| 15 | * @author Tobias Nyholm <[email protected]> |
|
| 16 | */ |
|
| 17 | final class DeleteResponse implements ApiResponse |
|
| 18 | { |
|
| 19 | /** |
|
| 20 | * @var string |
|
| 21 | */ |
|
| 22 | private $message; |
|
| 23 | ||
| 24 | /** |
|
| 25 | * @var string |
|
| 26 | */ |
|
| 27 | private $error; |
|
| 28 | ||
| 29 | /** |
|
| 30 | * @param string $message |
|
| 31 | * @param string $error |
|
| 32 | */ |
|
| 33 | private function __construct($message, $error) |
|
| 34 | { |
|
| 35 | $this->message = $message; |
|
| 36 | $this->error = $error; |
|
| 37 | } |
|
| 38 | ||
| 39 | /** |
|
| 40 | * @param array $data |
|
| 41 | * |
|
| 42 | * @return self |
|
| 43 | */ |
|
| 44 | public static function create(array $data) |
|
| 45 | { |
|
| 46 | return new self( |
|
| 47 | isset($data['message']) ? $data['message'] : null, |
|
| 48 | isset($data['error']) ? $data['error'] : null |
|
| 49 | ); |
|
| 50 | } |
|
| 51 | ||
| 52 | /** |
|
| 53 | * @return string |
|
| 54 | */ |
|
| 55 | public function getMessage() |
|
| 56 | { |
|
| 57 | return $this->message; |
|
| 58 | } |
|
| 59 | ||
| 60 | /** |
|
| 61 | * @return string |
|
| 62 | */ |
|
| 63 | public function getError() |
|
| 64 | { |
|
| 65 | return $this->error; |
|
| 66 | } |
|
| 67 | } |
|
| 68 | ||
| @@ 14-63 (lines=50) @@ | ||
| 11 | ||
| 12 | use Mailgun\Resource\ApiResponse; |
|
| 13 | ||
| 14 | final class ErrorResponse implements ApiResponse |
|
| 15 | { |
|
| 16 | /** |
|
| 17 | * @var string |
|
| 18 | */ |
|
| 19 | private $message; |
|
| 20 | ||
| 21 | /** |
|
| 22 | * @var string |
|
| 23 | */ |
|
| 24 | private $error; |
|
| 25 | ||
| 26 | /** |
|
| 27 | * @param string $error |
|
| 28 | */ |
|
| 29 | private function __construct($message, $error) |
|
| 30 | { |
|
| 31 | $this->message = $message; |
|
| 32 | $this->error = $error; |
|
| 33 | } |
|
| 34 | ||
| 35 | /** |
|
| 36 | * @param array |
|
| 37 | * |
|
| 38 | * @return self |
|
| 39 | */ |
|
| 40 | public static function create(array $data) |
|
| 41 | { |
|
| 42 | return new self( |
|
| 43 | isset($data['message']) ? $data['message'] : null, |
|
| 44 | isset($data['error']) ? $data['error'] : null |
|
| 45 | ); |
|
| 46 | } |
|
| 47 | ||
| 48 | /** |
|
| 49 | * @return string |
|
| 50 | */ |
|
| 51 | public function getMessage() |
|
| 52 | { |
|
| 53 | return $this->message; |
|
| 54 | } |
|
| 55 | ||
| 56 | /** |
|
| 57 | * @return string |
|
| 58 | */ |
|
| 59 | public function getError() |
|
| 60 | { |
|
| 61 | return $this->error; |
|
| 62 | } |
|
| 63 | } |
|
| 64 | ||
| @@ 17-67 (lines=51) @@ | ||
| 14 | /** |
|
| 15 | * @author David Garcia <[email protected]> |
|
| 16 | */ |
|
| 17 | final class DeleteResponse implements ApiResponse |
|
| 18 | { |
|
| 19 | /** |
|
| 20 | * @var string |
|
| 21 | */ |
|
| 22 | private $message; |
|
| 23 | ||
| 24 | /** |
|
| 25 | * @var string |
|
| 26 | */ |
|
| 27 | private $error; |
|
| 28 | ||
| 29 | /** |
|
| 30 | * @param array $data |
|
| 31 | * |
|
| 32 | * @return self |
|
| 33 | */ |
|
| 34 | public static function create(array $data) |
|
| 35 | { |
|
| 36 | return new self( |
|
| 37 | isset($data['message']) ? $data['message'] : null, |
|
| 38 | isset($data['error']) ? $data['error'] : null |
|
| 39 | ); |
|
| 40 | } |
|
| 41 | ||
| 42 | /** |
|
| 43 | * @param string $message |
|
| 44 | * @param string $error |
|
| 45 | */ |
|
| 46 | private function __construct($message, $error) |
|
| 47 | { |
|
| 48 | $this->message = $message; |
|
| 49 | $this->error = $error; |
|
| 50 | } |
|
| 51 | ||
| 52 | /** |
|
| 53 | * @return string |
|
| 54 | */ |
|
| 55 | public function getMessage() |
|
| 56 | { |
|
| 57 | return $this->message; |
|
| 58 | } |
|
| 59 | ||
| 60 | /** |
|
| 61 | * @return string |
|
| 62 | */ |
|
| 63 | public function getError() |
|
| 64 | { |
|
| 65 | return $this->error; |
|
| 66 | } |
|
| 67 | } |
|
| 68 | ||