Code Duplication    Length = 17-18 lines in 4 locations

Controllers/Frontend/PaymentKlarna.php 4 locations

@@ 555-571 (lines=17) @@
552
     * @param string $sessionID
553
     * @return bool
554
     */
555
    protected function checkKlarnaOrderExistsBySession($sessionID) {
556
        $sql = '
557
            SELECT * FROM s_order
558
            WHERE userID=?
559
        ';
560
        
561
        $order = Shopware()->Db()->fetchAll($sql, array(
562
                $sessionID
563
        ));
564
        
565
        $orderExists = (empty($order)) ? false : true;
566
        $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderExistsBySession:",3);   
567
        if ($orderExists){
568
            $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderExistsBySession: Order Found: ",3, $order);   
569
        }
570
        return $orderExists;
571
    }    
572
    
573
    /**
574
     * Method checks if certain klarna order exists or not
@@ 580-596 (lines=17) @@
577
     * @param string $paymentUniqueId
578
     * @return bool
579
     */
580
    protected function checkKlarnaOrderExistsByReference($paymentUniqueId) {
581
        $sql = '
582
            SELECT * FROM s_order
583
            WHERE temporaryID=?
584
        ';
585
        
586
        $order = Shopware()->Db()->fetchAll($sql, array(
587
                $paymentUniqueId
588
        ));
589
        
590
        $orderExists = (empty($order)) ? false : true;
591
        $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderExistsByReference:",3);   
592
        if ($orderExists){
593
            $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderExistsByReference: Order Found: ",3, $order);   
594
        }
595
        return $orderExists;
596
    }
597
    
598
    /**
599
     * Method checks if certain klarna order exists or not
@@ 605-621 (lines=17) @@
602
     * @param string $paymentUniqueId
603
     * @return bool
604
     */
605
    protected function checkKlarnaOrderExistsByReservation($transactionId) {
606
        $sql = '
607
            SELECT * FROM s_order
608
            WHERE transactionID=?
609
        ';
610
        
611
        $order = Shopware()->Db()->fetchAll($sql, array(
612
                $transactionId
613
        ));
614
        
615
        $orderExists = (empty($order)) ? false : true;
616
        $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderExistsByReservation:",3);   
617
        if ($orderExists){
618
            $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderExistsByReservation: Order Found: ",3, $order);   
619
        }
620
        return $orderExists;
621
    }    
622
    
623
    /**
624
     * Method checks if certain klarna order exists or not
@@ 654-671 (lines=18) @@
651
     * @param string $sessionID
652
     * @return bool
653
     */
654
    protected function checkKlarnaOrderDetailsBySession($sessionID) {
655
        $sql = '
656
            SELECT * FROM s_order
657
            LEFT JOIN s_order_details ON s_order.id = s_order_details.orderID
658
            WHERE userID=?
659
        ';
660
        
661
        $orderDetails = Shopware()->Db()->fetchAll($sql, array(
662
                $sessionID
663
        ));
664
        
665
        $orderExists = (empty($orderDetails)) ? false : true;
666
        $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderDetailsBySession:",3);   
667
        if ($orderExists){
668
            $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderDetailsBySession: OrderDetails Found: ",3, $orderDetails);
669
        }
670
        return $orderExists;
671
    }     
672
673
    /**
674
     * Notify action method