Пример #1
0
 /**
  * Assert Shipment exists
  *
  * @param string shipmentKey
  * @param bool is key already prefixed
  * @return bool hasShipment
  */
 public function hasShipment($key, $isKey = true)
 {
     if (!$isKey) {
         $key = Shipment::getKey($key);
     }
     return isset($this->_shipments[$key]);
 }
Пример #2
0
 /**
  * Remove a specified Shipment from this Discount
  *
  * @param string
  * @return Discount
  */
 public function unsetShipment($key)
 {
     if ($key instanceof Shipment) {
         $key = Shipment::getKey($key->getId());
     }
     if (!count($this->getShipments())) {
         return $this;
     }
     $newShipments = array_flip($this->getShipments());
     unset($newShipments[$key]);
     $newShipments = array_flip($newShipments);
     $this->_shipments = $newShipments;
     return $this;
 }