Пример #1
0
 /**
  * Comparison states function for usort()
  *
  * @param \XLite\Model\State $a First state object
  * @param \XLite\Model\State $b Second state object
  *
  * @return integer
  */
 public static function sortStates($a, $b)
 {
     $aCountry = $a->getCountry()->getCountry();
     $aState = $a->getState();
     $bCountry = $b->getCountry()->getCountry();
     $bState = $b->getState();
     if ($aCountry == $bCountry && $aState == $bState) {
         $result = 0;
     } elseif ($aCountry == $bCountry) {
         $result = $aState > $bState ? 1 : -1;
     } else {
         $result = $aCountry > $bCountry ? 1 : -1;
     }
     return $result;
 }
Пример #2
0
 /**
  * {@inheritDoc}
  */
 public function getCountry()
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'getCountry', array());
     return parent::getCountry();
 }