Beispiel #1
0
 /**
  * Function for sorting by uasort
  * @param HotelStack $a
  * @param HotelStack $b
  */
 private static function compareStacksByHotelsParams($a, $b)
 {
     if (is_object($a->getHotel()) and $a->getHotel() instanceof Hotel) {
         $valA = $a->getHotel()->getValueOfParam(self::$sortParam);
     } else {
         throw new CException('Incorrect first hotel incoming to compareness: ' . VarDumper::dumpAsString($a));
     }
     if (is_object($b->getHotel()) and $b->getHotel() instanceof Hotel) {
         $valB = $b->getHotel()->getValueOfParam(self::$sortParam);
     } else {
         throw new CException('Incorrect second hotel incoming to compareness: ' . VarDumper::dumpAsString($b));
     }
     if ($valA < $valB) {
         return -1;
     } elseif ($valA > $valB) {
         return 1;
     }
     return 0;
 }