예제 #1
0
 protected function validateWhere($rule)
 {
     $allowedOperations = array('=', '>', '<', '<>', '>=', '<=', 'between', 'like', 'in');
     if (!in_array($rule['op'], $allowedOperations)) {
         throw \DomainException("{$rule['op']} is not allowed.");
     }
     return true;
 }
예제 #2
0
 /**
  * Add Item
  * 
  * @param Item $item
  * 
  * @return void
  * 
  * @throws \DomainException
  */
 public function addItem(Item $item)
 {
     if (!$this->canAddItem($item)) {
         throw \DomainException('Item value is greater than limit.');
     }
     $this->items[] = $item;
     $this->totalPrice += $item->getPrice();
     $this->totalWeight += $item->getWeight();
 }