You are here

private function ReservationConflicts::merci_bucket_cmp_length in MERCI (Manage Equipment Reservations, Checkout and Inventory) 8.2

File

src/ReservationConflicts.php, line 560
Contains \Drupal\merci\ReservationConflicts. Abstraction of the selection logic of an entity reference field.

Class

ReservationConflicts
A null implementation of EntityReference_SelectionHandler.

Namespace

Drupal\merci

Code

private function merci_bucket_cmp_length($a, $b) {
  $value = $this->date_column;
  $end_value = $this->date_column2;
  $len_a = date_format(date_create($a->{$end_value}), 'U') - date_format(date_create($a->{$value}), 'U');
  $len_b = date_format(date_create($b->{$end_value}), 'U') - date_format(date_create($b->{$value}), 'U');
  if ($len_a == $len_b) {
    return 0;
  }
  return $len_a < $len_b ? 1 : -1;
}