コード例 #1
0
ファイル: Address.php プロジェクト: kirkbauer2/kirkxc
 /**
  * Set state
  *
  * @param mixed $state State object or state id or custom state name
  *
  * @return void
  * @todo Refactor?
  */
 public function setState($state)
 {
     if ($state instanceof \XLite\Model\State) {
         // Set by state object
         if ($state->getStateId()) {
             if (!$this->state || $this->state->getStateId() != $state->getStateId()) {
                 $this->state = $state;
             }
             $this->setCustomState($this->state->getState());
         } else {
             $this->state = null;
             $this->setCustomState($state->getState());
         }
     } elseif (is_string($state)) {
         // Set custom state
         $this->state = null;
         $this->setCustomState($state);
     }
 }
コード例 #2
0
ファイル: Zone.php プロジェクト: kewaunited/xcart
 /**
  * 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;
 }
コード例 #3
0
 /**
  * {@inheritDoc}
  */
 public function getState()
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'getState', array());
     return parent::getState();
 }