示例#1
0
文件: EventId.php 项目: texdc/momento
 /**
  * Parse a string into an id
  *
  * @param  string $eventId the string to parse
  * @return EventId
  * @throws InvalidArgumentException when the string format is invalid
  */
 public static function fromString($eventId)
 {
     $parts = explode('_', $eventId);
     if (count($parts) != 3) {
         throw EventException::invalidId($eventId);
     }
     $id = new static($parts[0]);
     $id->time = (double) $parts[1];
     $id->hash = (string) $parts[2];
     return $id;
 }