/**
  * Returns a human readable change ID, containing multiple IDs in case of a
  * coalesced change.
  *
  * @param Change $change
  *
  * @return string
  */
 private function getChangeIdForLog(Change $change)
 {
     if ($change instanceof EntityChange) {
         //@todo: add getFields() to the Change interface, or provide getters!
         $fields = $change->getFields();
         if (isset($fields['info']['change-ids'])) {
             return implode('|', $fields['info']['change-ids']);
         }
     }
     return $change->getId();
 }
 /**
  * Compares two changes based on their timestamp.
  *
  * @param Change $a
  * @param Change $b
  *
  * @return int
  */
 public function compareChangesByTimestamp(Change $a, Change $b)
 {
     //NOTE: beware https://bugs.php.net/bug.php?id=50688 !
     if ($a->getTime() > $b->getTime()) {
         return 1;
     } elseif ($a->getTime() < $b->getTime()) {
         return -1;
     }
     if ($a->getId() > $b->getId()) {
         return 1;
     } elseif ($a->getId() < $b->getId()) {
         return -1;
     }
     return 0;
 }
 /**
  * Checks whether the given Change is somehow relevant to the given wiki site.
  *
  * In particular this check whether the Change modifies any sitelink that refers to the
  * given wiki site.
  *
  * @note: this does not check whether the entity that was changes is or is not at all
  *        connected with (resp. used on) the target wiki.
  *
  * @param Change $change the change to examine.
  * @param string $siteID the site to consider.
  *
  * @return bool
  */
 private function isRelevantChange(Change $change, $siteID)
 {
     if ($change instanceof ItemChange && !$change->isEmpty()) {
         $siteLinkDiff = $change->getSiteLinkDiff();
         if (isset($siteLinkDiff[$siteID])) {
             return true;
         }
     }
     return false;
 }