Code Duplication    Length = 17-18 lines in 4 locations

Controllers/Frontend/PaymentKlarna.php 4 locations

@@ 569-585 (lines=17) @@
566
     * @param string $sessionID
567
     * @return bool
568
     */
569
    protected function checkKlarnaOrderExistsBySession($sessionID) {
570
        $sql = '
571
            SELECT * FROM s_order
572
            WHERE userID=?
573
        ';
574
        
575
        $order = Shopware()->Db()->fetchAll($sql, array(
576
                $sessionID
577
        ));
578
        
579
        $orderExists = (empty($order)) ? false : true;
580
        $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderExistsBySession:",3);   
581
        if ($orderExists){
582
            $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderExistsBySession: Order Found: ",3, $order);   
583
        }
584
        return $orderExists;
585
    }    
586
    
587
    /**
588
     * Method checks if certain klarna order exists or not
@@ 594-610 (lines=17) @@
591
     * @param string $paymentUniqueId
592
     * @return bool
593
     */
594
    protected function checkKlarnaOrderExistsByReference($paymentUniqueId) {
595
        $sql = '
596
            SELECT * FROM s_order
597
            WHERE temporaryID=?
598
        ';
599
        
600
        $order = Shopware()->Db()->fetchAll($sql, array(
601
                $paymentUniqueId
602
        ));
603
        
604
        $orderExists = (empty($order)) ? false : true;
605
        $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderExistsByReference:",3);   
606
        if ($orderExists){
607
            $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderExistsByReference: Order Found: ",3, $order);   
608
        }
609
        return $orderExists;
610
    }
611
    
612
    /**
613
     * Method checks if certain klarna order exists or not
@@ 619-635 (lines=17) @@
616
     * @param string $paymentUniqueId
617
     * @return bool
618
     */
619
    protected function checkKlarnaOrderExistsByReservation($transactionId) {
620
        $sql = '
621
            SELECT * FROM s_order
622
            WHERE transactionID=?
623
        ';
624
        
625
        $order = Shopware()->Db()->fetchAll($sql, array(
626
                $transactionId
627
        ));
628
        
629
        $orderExists = (empty($order)) ? false : true;
630
        $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderExistsByReservation:",3);   
631
        if ($orderExists){
632
            $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderExistsByReservation: Order Found: ",3, $order);   
633
        }
634
        return $orderExists;
635
    }    
636
    
637
    /**
638
     * Method checks if certain klarna order exists or not
@@ 669-686 (lines=18) @@
666
     * @param string $sessionID
667
     * @return bool
668
     */
669
    protected function checkKlarnaOrderDetailsBySession($sessionID) {
670
        $sql = '
671
            SELECT * FROM s_order
672
            LEFT JOIN s_order_details ON s_order.id = s_order_details.orderID
673
            WHERE userID=?
674
        ';
675
        
676
        $orderDetails = Shopware()->Db()->fetchAll($sql, array(
677
                $sessionID
678
        ));
679
        
680
        $orderExists = (empty($orderDetails)) ? false : true;
681
        $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderDetailsBySession:",3);   
682
        if ($orderExists){
683
            $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderDetailsBySession: OrderDetails Found: ",3, $orderDetails);
684
        }
685
        return $orderExists;
686
    }
687
    
688
    /**
689
     * Method checks if certain klarna order exists or not