| Total Complexity | 7 |
| Total Lines | 61 |
| Duplicated Lines | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 11 | class TokenOptions implements JsonSerializable |
||
| 12 | { |
||
| 13 | /** @var string */ |
||
| 14 | private $data; |
||
| 15 | /** @var string */ |
||
| 16 | private $role; |
||
| 17 | /** @var KurentoOptions */ |
||
| 18 | private $kurentoOptions; |
||
| 19 | |||
| 20 | |||
| 21 | /** |
||
| 22 | * TokenOptions constructor. |
||
| 23 | * @param string $role |
||
| 24 | * @param string|null $data |
||
| 25 | * @param KurentoOptions|null $kurentoOptions |
||
| 26 | */ |
||
| 27 | public function __construct(string $role, ?string $data = null, ?KurentoOptions $kurentoOptions = null) |
||
| 28 | { |
||
| 29 | $this->role = $role; |
||
| 30 | $this->data = $data; |
||
| 31 | $this->kurentoOptions = $kurentoOptions; |
||
| 32 | } |
||
| 33 | |||
| 34 | /** |
||
| 35 | * Convert the model instance to JSON. |
||
| 36 | * |
||
| 37 | * @param int $options |
||
| 38 | * @return string |
||
| 39 | * |
||
| 40 | */ |
||
| 41 | public function toJson($options = 0): string |
||
| 42 | { |
||
| 43 | return json_encode($this->jsonSerialize(), $options); |
||
| 44 | } |
||
| 45 | |||
| 46 | /** |
||
| 47 | * Specify data which should be serialized to JSON |
||
| 48 | * @link https://php.net/manual/en/jsonserializable.jsonserialize.php |
||
| 49 | * @return mixed data which can be serialized by <b>json_encode</b>, |
||
| 50 | * which is a value of any type other than a resource. |
||
| 51 | * @since 5.4.0 |
||
| 52 | */ |
||
| 53 | public function jsonSerialize() |
||
| 54 | { |
||
| 55 | return $this->toArray(); |
||
| 56 | } |
||
| 57 | |||
| 58 | /** |
||
| 59 | * Convert the model instance to an array. |
||
| 60 | * |
||
| 61 | * @return array |
||
| 62 | */ |
||
| 63 | public function toArray(): array |
||
| 72 | } |
||
| 73 | |||
| 74 | } |
||
| 75 |