コード例 #1
0
 /**
  * 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;
 }
コード例 #2
0
 /**
  * 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();
 }