| 1 |
<?php |
| 2 |
/** |
| 3 |
* @package VikBooking |
| 4 |
* @subpackage core |
| 5 |
* @author E4J s.r.l. |
| 6 |
* @copyright Copyright (C) 2025 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 |
* Door Access device capability result implementation. |
| 16 |
* |
| 17 |
* @since 1.18.4 (J) - 1.8.4 (WP) |
| 18 |
*/ |
| 19 |
final class VBODooraccessDeviceCapabilityResult |
| 20 |
{ |
| 21 |
/** |
| 22 |
* @var ?string |
| 23 |
*/ |
| 24 |
protected ?string $passcode = null; |
| 25 |
|
| 26 |
/** |
| 27 |
* @var ?string |
| 28 |
*/ |
| 29 |
protected ?string $html = null; |
| 30 |
|
| 31 |
/** |
| 32 |
* @var ?string |
| 33 |
*/ |
| 34 |
protected ?string $text = null; |
| 35 |
|
| 36 |
/** |
| 37 |
* @var ?array |
| 38 |
*/ |
| 39 |
protected ?array $properties = null; |
| 40 |
|
| 41 |
/** |
| 42 |
* Class constructor. |
| 43 |
* |
| 44 |
* @param ?array $data Optional result data properties to bind. |
| 45 |
*/ |
| 46 |
public function __construct(?array $data = null) |
| 47 |
{ |
| 48 |
if ($data) { |
| 49 |
// bind result data properties |
| 50 |
$this->properties = $data; |
| 51 |
} |
| 52 |
} |
| 53 |
|
| 54 |
/** |
| 55 |
* Returns the result passcode string. |
| 56 |
* |
| 57 |
* @return ?string |
| 58 |
*/ |
| 59 |
public function getPasscode() |
| 60 |
{ |
| 61 |
return $this->passcode; |
| 62 |
} |
| 63 |
|
| 64 |
/** |
| 65 |
* Sets the passcode result string. |
| 66 |
* |
| 67 |
* @param string $passcode The passcode to set. |
| 68 |
* |
| 69 |
* @return self |
| 70 |
*/ |
| 71 |
public function setPasscode(string $passcode) |
| 72 |
{ |
| 73 |
$this->passcode = $passcode; |
| 74 |
|
| 75 |
return $this; |
| 76 |
} |
| 77 |
|
| 78 |
/** |
| 79 |
* Returns the HTML result output string. |
| 80 |
* |
| 81 |
* @return ?string |
| 82 |
*/ |
| 83 |
public function getOutput() |
| 84 |
{ |
| 85 |
return $this->html; |
| 86 |
} |
| 87 |
|
| 88 |
/** |
| 89 |
* Sets the HTML output string. |
| 90 |
* |
| 91 |
* @param string $output The result value to set. |
| 92 |
* |
| 93 |
* @return self |
| 94 |
*/ |
| 95 |
public function setOutput(string $output) |
| 96 |
{ |
| 97 |
$this->html = $output; |
| 98 |
|
| 99 |
return $this; |
| 100 |
} |
| 101 |
|
| 102 |
/** |
| 103 |
* Returns the text result string. |
| 104 |
* |
| 105 |
* @return ?string |
| 106 |
*/ |
| 107 |
public function getText() |
| 108 |
{ |
| 109 |
return $this->text; |
| 110 |
} |
| 111 |
|
| 112 |
/** |
| 113 |
* Sets the text result string. |
| 114 |
* |
| 115 |
* @param string $output The result value to set. |
| 116 |
* |
| 117 |
* @return self |
| 118 |
*/ |
| 119 |
public function setText(string $output) |
| 120 |
{ |
| 121 |
$this->text = $output; |
| 122 |
|
| 123 |
return $this; |
| 124 |
} |
| 125 |
|
| 126 |
/** |
| 127 |
* Returns the result data properties array (nullable). |
| 128 |
* |
| 129 |
* @return ?array |
| 130 |
*/ |
| 131 |
public function getProperties() |
| 132 |
{ |
| 133 |
return $this->properties; |
| 134 |
} |
| 135 |
|
| 136 |
/** |
| 137 |
* Binds the result data properties array. |
| 138 |
* |
| 139 |
* @param array $data Data properties to bind. |
| 140 |
* |
| 141 |
* @return self |
| 142 |
*/ |
| 143 |
public function setProperties(array $data) |
| 144 |
{ |
| 145 |
$this->properties = $data; |
| 146 |
|
| 147 |
return $this; |
| 148 |
} |
| 149 |
|
| 150 |
/** |
| 151 |
* Returns the proper result output value. |
| 152 |
*/ |
| 153 |
public function __toString() |
| 154 |
{ |
| 155 |
return $this->getOutput() ?: $this->getText(); |
| 156 |
} |
| 157 |
} |
| 158 |
|