@@ -70,16 +70,10 @@ public static function fromEntityId(EntityId $entityId): self
7070 return self ::fromArgs (id: "entity: {$ entityId }" );
7171 }
7272
73- protected static function create (...$ args ): static
74- {
75- $ obj = parent ::create ($ args );
76- $ obj ->id = $ args ['id ' ];
77- return $ obj ;
78- }
79-
8073 public function toActivityId (): string
8174 {
8275 $ parts = explode (': ' , $ this ->id , 3 );
76+
8377 return match ($ parts ) {
8478 ['orchestration ' , $ parts [1 ]] => throw new Exception ('Cannot convert orchestration state to activity id ' ),
8579 ['activity ' , $ parts [1 ]] => Uuid::fromString ($ parts [1 ])->toString (),
@@ -95,6 +89,7 @@ public static function fromString(string $id): self
9589 public function toOrchestrationInstance (): OrchestrationInstance
9690 {
9791 $ parts = explode (': ' , $ this ->id , 3 );
92+
9893 return match ($ parts ) {
9994 ['activity ' , $ parts [1 ]] => throw new Exception ('Cannot convert activity state to orchestration instance ' ),
10095 ['orchestration ' , $ parts [1 ], $ parts [2 ]] => OrchestrationInstance ($ parts [1 ], $ parts [2 ]),
@@ -107,6 +102,7 @@ public function toOrchestrationInstance(): OrchestrationInstance
107102 public function toEntityId (): EntityId
108103 {
109104 $ parts = explode (': ' , $ this ->id , 3 );
105+
110106 return match ($ parts ) {
111107 ['activity ' , $ parts [1 ]] => throw new Exception ('Cannot convert activity state to entity id ' ),
112108 ['orchestration ' , $ parts [1 ], $ parts [2 ]] => throw new Exception (
@@ -127,14 +123,15 @@ public function isActivityId(): bool
127123 public function getStateType (): string
128124 {
129125 $ parts = explode (': ' , $ this ->id , 3 );
126+
130127 return match ($ parts ) {
131128 ['activity ' , $ parts [1 ]] => ActivityHistory::class,
132129 ['orchestration ' , $ parts [1 ], $ parts [2 ]] => OrchestrationHistory::class,
133130 ['entity ' , $ parts [1 ], $ parts [2 ]] => EntityHistory::class,
134131 };
135132 }
136133
137- public function getPartitionKey (int $ totalPartitions ): int | null
134+ public function getPartitionKey (int $ totalPartitions ): ? int
138135 {
139136 return match ($ this ->isPartitioned ()) {
140137 true => crc32 ($ this ->id ) % $ totalPartitions ,
0 commit comments