diff --git a/src/Events/Events.php b/src/Events/Events.php index 468a45e..d2e66c0 100644 --- a/src/Events/Events.php +++ b/src/Events/Events.php @@ -565,7 +565,7 @@ private static function normalizeObjects($objectOrObjects): array } return array_map(function ($object) { if ($object instanceof ObjectProperties) { - return $object; + return $object->toArray(); } if (is_string($object)) { return ["objectId" => $object]; diff --git a/src/Events/ObjectProperties.php b/src/Events/ObjectProperties.php index fa3407a..d4c1cb6 100644 --- a/src/Events/ObjectProperties.php +++ b/src/Events/ObjectProperties.php @@ -8,6 +8,19 @@ class ObjectProperties * @var string */ public $objectId; + /** + * @var string + */ + public $ticketType; + /** + * @var int + */ + public $quantity; + /** + * @var array + */ + public $extraData; + public function __construct(string $objectId) { @@ -31,4 +44,19 @@ public function setExtraData(array $extraData): self $this->extraData = $extraData; return $this; } + + public function toArray() + { + $result = ["objectId" => $this->objectId]; + if ($this->ticketType !== null) { + $result["ticketType"] = $this->ticketType; + } + if ($this->quantity !== null) { + $result["quantity"] = $this->quantity; + } + if($this->extraData !== null) { + $result["extraData"] = $this->extraData; + } + return $result; + } } diff --git a/tests/Workspaces/ListActiveWorkspacesTest.php b/tests/Workspaces/ListActiveWorkspacesTest.php index 743b66c..4fb022b 100644 --- a/tests/Workspaces/ListActiveWorkspacesTest.php +++ b/tests/Workspaces/ListActiveWorkspacesTest.php @@ -20,7 +20,7 @@ public function test() return $workspace->name; }); - self::assertEquals(["ws3", "ws1", "Default workspace"], array_values($workspaceNames)); + self::assertEquals(["ws3", "ws1", "Production workspace"], array_values($workspaceNames)); } public function test_filter() diff --git a/tests/Workspaces/ListWorkspacesTest.php b/tests/Workspaces/ListWorkspacesTest.php index 0f7a0d0..b62fa10 100644 --- a/tests/Workspaces/ListWorkspacesTest.php +++ b/tests/Workspaces/ListWorkspacesTest.php @@ -20,7 +20,7 @@ public function test() return $workspace->name; }); - self::assertEquals(["ws3", "ws2", "ws1", "Default workspace"], array_values($workspaceNames)); + self::assertEquals(["ws3", "ws2", "ws1", "Production workspace"], array_values($workspaceNames)); } public function test_filter()