示例#1
0
 /**
  * Sets the packaging unit for a specific distributor.
  * 
  * For example, some distributors only sell resistors in packs of 100, so you can't order just one. We use the
  * packagingUnit to calculate how many pieces will be delivered once ordered. So if your stock level falls below
  * the minimum (example: you would need to order 10 resistors), we suggest that you only order one resistor pack
  * instead of 10.
  *   
  * @param int $packagingUnit The amount of items in one package
  * @throws \PartKeepr\Part\OutOfRangeException When the packaging unit is less than 1
  */
 public function setPackagingUnit($packagingUnit)
 {
     $packagingUnit = intval($packagingUnit);
     if ($packagingUnit < 1) {
         $exception = new OutOfRangeException(PartKeepr::i18n("Packaging Unit is out of range"));
         $exception->setDetail(PartKeepr::i18n("The packaging unit must be 1 or higher"));
         throw $exception;
     }
     $this->packagingUnit = $packagingUnit;
 }