id = $id; $this->object_type = $object_type; $this->object_id = $object_id; $this->version = $version; $this->attempts = $attempts; } /** * Creates an item from a database row. * * @since 1.5.0 * * @param array $row Row with id, object_type, object_id, version and attempts. * @return self The item. */ public static function from_row( array $row ): self { return new self( (int) $row['id'], (string) $row['object_type'], (int) $row['object_id'], (int) $row['version'], (int) $row['attempts'] ); } /** * Returns the row ID. * * @since 1.5.0 * * @return int The row ID. */ public function get_id(): int { return $this->id; } /** * Returns the object type. * * @since 1.5.0 * * @return string The object type. */ public function get_object_type(): string { return $this->object_type; } /** * Returns the object ID. * * @since 1.5.0 * * @return int The object ID. */ public function get_object_id(): int { return $this->object_id; } /** * Returns the row version when read. * * @since 1.5.0 * * @return int The version. */ public function get_version(): int { return $this->version; } /** * Returns the attempts already made. * * @since 1.5.0 * * @return int The attempt count. */ public function get_attempts(): int { return $this->attempts; } }