original_string: private function calculateTotalAmountForDeliveryExpenses(Transaction $transaction)
      {
          $total = 0;
          foreach ($transaction->getItems() as $productPurchase) {
              if($productPurchase->getProduct() instanceof Product){
                  if(!$productPurchase->getProduct()->isFreeTransport()){
                      $addPercent = 0;
                      if($this->deliveryExpensesPercentage > 0) 
                          $addPercent = $productPurchase->getTotalPrice() * $this->deliveryExpensesPercentage;
                      
                      $total += $productPurchase->getTotalPrice() + $addPercent;
                  }
              }else{
                  $total += $productPurchase->getTotalPrice();
              }
          }
          return $total;
      }
code: private function calculateTotalAmountForDeliveryExpenses(Transaction $transaction)
      {
          $total = 0;
          foreach ($transaction->getItems() as $productPurchase) {
              if($productPurchase->getProduct() instanceof Product){
                  if(!$productPurchase->getProduct()->isFreeTransport()){
                      $addPercent = 0;
                      if($this->deliveryExpensesPercentage > 0) 
                          $addPercent = $productPurchase->getTotalPrice() * $this->deliveryExpensesPercentage;
                      
                      $total += $productPurchase->getTotalPrice() + $addPercent;
                  }
              }else{
                  $total += $productPurchase->getTotalPrice();
              }
          }
          return $total;
      }
code_tokens: private function calculateTotalAmountForDeliveryExpenses ( Transaction $ transaction ) { $ total = 0 ; foreach ( $ transaction -> getItems ( ) as $ productPurchase ) { if ( $ productPurchase -> getProduct ( ) instanceof Product ) { if ( ! $ productPurchase -> getProduct ( ) -> isFreeTransport ( ) ) { $ addPercent = 0 ; if ( $ this -> deliveryExpensesPercentage > 0 ) $ addPercent = $ productPurchase -> getTotalPrice ( ) * $ this -> deliveryExpensesPercentage ; $ total += $ productPurchase -> getTotalPrice ( ) + $ addPercent ; } } else { $ total += $ productPurchase -> getTotalPrice ( ) ; } } return $ total ; }
docstring: Calculate total amount for delivery expenses
  
  @param Transaction    $transaction
  
  @return float $total
docstring_tokens: Calculate total amount for delivery expenses