/**
  * Creates a new, unsaved line item, but if it's a ticket line item
  * with a total of 0, or a subtotal of 0, returns null instead
  * @param EEI_Line_Item $line_item
  * @return EEI_Line_Item
  */
 protected function _filter_zero_line_item(EEI_Line_Item $line_item)
 {
     if ($line_item->type() === EEM_Line_Item::type_line_item && $line_item->OBJ_type() === 'Ticket' && $line_item->quantity() == 0) {
         return null;
     }
     return $line_item;
 }
 /**
  * Adjusts quantities for line items for tickets according to the registrations provided
  * in the constructor
  * @param EEI_Line_Item $line_item
  * @return EEI_Line_Item
  */
 protected function _filter_billable_line_item(EEI_Line_Item $line_item)
 {
     // is this a ticket ?
     if ($line_item->type() === EEM_Line_Item::type_line_item && $line_item->OBJ_type() == 'Ticket') {
         // if this ticket is billable at this moment, then we should have a positive quantity
         if (isset($this->_counts_per_line_item_code[$line_item->code()])) {
             // set quantity based on number of billable registrations for this ticket
             $quantity = $this->_counts_per_line_item_code[$line_item->code()];
         } else {
             $quantity = 0;
         }
         $line_item->set_quantity($quantity);
         $line_item->set_total($line_item->unit_price() * $line_item->quantity());
     }
     return $line_item;
 }