Updated WebAppData
This commit is contained in:
parent
5557a49e17
commit
a214a7c736
1 changed files with 10 additions and 18 deletions
|
@ -6,15 +6,8 @@
|
||||||
|
|
||||||
class WebAppData implements ObjectTypeInterface
|
class WebAppData implements ObjectTypeInterface
|
||||||
{
|
{
|
||||||
/**
|
private string $data;
|
||||||
* @var string
|
private string $button_text;
|
||||||
*/
|
|
||||||
private $data;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
private $button_text;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The data. Be aware that a bad client can send arbitrary data in this field.
|
* The data. Be aware that a bad client can send arbitrary data in this field.
|
||||||
|
@ -38,9 +31,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an array representation of the object.
|
* @inheritDoc
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*/
|
*/
|
||||||
public function toArray(): array
|
public function toArray(): array
|
||||||
{
|
{
|
||||||
|
@ -51,15 +42,16 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs the object from an array representation.
|
* @inheritDoc
|
||||||
*
|
|
||||||
* @param array $data
|
|
||||||
* @return WebAppData
|
|
||||||
*/
|
*/
|
||||||
public static function fromArray(array $data): self
|
public static function fromArray(?array $data): ?WebAppData
|
||||||
{
|
{
|
||||||
$object = new self();
|
if($data === null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$object = new self();
|
||||||
$object->data = $data['data'] ?: '';
|
$object->data = $data['data'] ?: '';
|
||||||
$object->button_text = $data['button_text'] ?: '';
|
$object->button_text = $data['button_text'] ?: '';
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue