Skip to content

Commit

Permalink
added getEventFromInt
Browse files Browse the repository at this point in the history
  • Loading branch information
arusinowski committed May 8, 2024
1 parent 44ad7b3 commit f851c37
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/Model/Status/MessageEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,23 @@ public function getEventAsInt(): int
};
}

/**
* Get Event enum from int value
*/
public static function getEventFromInt(?int $eventInt): ?self
{
return match ($eventInt) {
1 => self::Seen,
2 => self::Invalid,
3 => self::Start,
4 => self::Exception,
5 => self::Success,
6 => self::Reject,
7 => self::Failure,
default => null,
};
}

/**
* Get as options
*/
Expand Down

0 comments on commit f851c37

Please sign in to comment.