How does the Ticket::check function work? (#237)

Posted by @acf986:

In side the class Ticket we have the following function

 std::unique_ptr<Ticket> Ticket::check(
    ItineraryVersion version,
    bool nullifying = false);

which from my understanding is used to check and eliminate the inconsistency of the itinerary changes.

But how does this function work? Could someone provide some more details?