Updated Dice

This commit is contained in:
netkas 2024-10-04 15:04:16 -04:00
parent 3eae8f43c8
commit 7dce9a5f8e

View file

@ -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;