implementors
1 month ago
plugins
1 month ago
api.php
1 month ago
autoload.php
1 month ago
error.php
1 month ago
event.php
1 month ago
index.html
1 month ago
response.php
1 month ago
user.php
1 month ago
error.php
71 lines
| 1 | <?php |
| 2 | /** |
| 3 | * @package VikAppointments |
| 4 | * @subpackage core |
| 5 | * @author E4J s.r.l. |
| 6 | * @copyright Copyright (C) 2021 E4J s.r.l. All Rights Reserved. |
| 7 | * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL |
| 8 | * @link https://vikwp.com |
| 9 | */ |
| 10 | |
| 11 | // No direct access |
| 12 | defined('ABSPATH') or die('No script kiddies please!'); |
| 13 | |
| 14 | /** |
| 15 | * The API error representation. |
| 16 | * |
| 17 | * @since 1.7 |
| 18 | */ |
| 19 | class VAPApiError implements JsonSerializable |
| 20 | { |
| 21 | /** |
| 22 | * The identifier code of the error. |
| 23 | * |
| 24 | * @var integer |
| 25 | */ |
| 26 | public $errcode; |
| 27 | |
| 28 | /** |
| 29 | * The text description of the error. |
| 30 | * |
| 31 | * @var string |
| 32 | */ |
| 33 | public $error; |
| 34 | |
| 35 | /** |
| 36 | * Class constructor. |
| 37 | * |
| 38 | * @param integer $errcode The code identifier. |
| 39 | * @param string $error The text description. |
| 40 | */ |
| 41 | public function __construct($errcode, $error) |
| 42 | { |
| 43 | $this->errcode = $errcode; |
| 44 | $this->error = $error; |
| 45 | } |
| 46 | |
| 47 | /** |
| 48 | * Return this object encoded in JSON. |
| 49 | * |
| 50 | * @return string This object in JSON. |
| 51 | */ |
| 52 | public function toJSON() |
| 53 | { |
| 54 | return json_encode($this); |
| 55 | } |
| 56 | |
| 57 | /** |
| 58 | * Creates a standard object, containing all the supported properties, |
| 59 | * to be used when this class is passed to "json_encode()". |
| 60 | * |
| 61 | * @return object |
| 62 | * |
| 63 | * @see JsonSerializable |
| 64 | */ |
| 65 | #[ReturnTypeWillChange] |
| 66 | public function jsonSerialize() |
| 67 | { |
| 68 | return get_object_vars($this); |
| 69 | } |
| 70 | } |
| 71 |