Updated Dice
This commit is contained in:
parent
3eae8f43c8
commit
7dce9a5f8e
1 changed files with 10 additions and 18 deletions
|
@ -7,15 +7,8 @@
|
||||||
|
|
||||||
class Dice implements ObjectTypeInterface
|
class Dice implements ObjectTypeInterface
|
||||||
{
|
{
|
||||||
/**
|
private string $emoji;
|
||||||
* @var string
|
private int $value;
|
||||||
*/
|
|
||||||
private $emoji;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var int
|
|
||||||
*/
|
|
||||||
private $value;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return string
|
* @return string
|
||||||
|
@ -34,9 +27,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs object from array representation
|
* @inheritDoc
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*/
|
*/
|
||||||
public function toArray(): array
|
public function toArray(): array
|
||||||
{
|
{
|
||||||
|
@ -47,15 +38,16 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs object from array representation
|
* @inheritDoc
|
||||||
*
|
|
||||||
* @param array $data
|
|
||||||
* @return Dice
|
|
||||||
*/
|
*/
|
||||||
public static function fromArray(array $data): self
|
public static function fromArray(?array $data): ?Dice
|
||||||
{
|
{
|
||||||
$object = new self();
|
if($data === null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$object = new self();
|
||||||
$object->emoji = $data['emoji'] ?? null;
|
$object->emoji = $data['emoji'] ?? null;
|
||||||
$object->value = $data['value'] ?? null;
|
$object->value = $data['value'] ?? null;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue