Code Duplication    Length = 17-18 lines in 4 locations

Controllers/Frontend/PaymentKlarna.php 4 locations

@@ 1040-1056 (lines=17) @@
1037
     * @param string $sessionID
1038
     * @return bool
1039
     */
1040
    protected function checkKlarnaOrderExistsBySession($sessionID) {
1041
        $sql = '
1042
            SELECT * FROM s_order
1043
            WHERE userID=?
1044
        ';
1045
        
1046
        $order = Shopware()->Db()->fetchAll($sql, array(
1047
                $sessionID
1048
        ));
1049
        
1050
        $orderExists = (empty($order)) ? false : true;
1051
        $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderExistsBySession:",3);   
1052
        if ($orderExists){
1053
            $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderExistsBySession: Order Found: ",3, $order);   
1054
        }
1055
        return $orderExists;
1056
    }    
1057
    
1058
    /**
1059
     * Method checks if certain klarna order exists or not
@@ 1065-1081 (lines=17) @@
1062
     * @param string $paymentUniqueId
1063
     * @return bool
1064
     */
1065
    protected function checkKlarnaOrderExistsByReference($paymentUniqueId) {
1066
        $sql = '
1067
            SELECT * FROM s_order
1068
            WHERE temporaryID=?
1069
        ';
1070
        
1071
        $order = Shopware()->Db()->fetchAll($sql, array(
1072
                $paymentUniqueId
1073
        ));
1074
        
1075
        $orderExists = (empty($order)) ? false : true;
1076
        $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderExistsByReference:",3);   
1077
        if ($orderExists){
1078
            $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderExistsByReference: Order Found: ",3, $order);   
1079
        }
1080
        return $orderExists;
1081
    }
1082
    
1083
    /**
1084
     * Method checks if certain klarna order exists or not
@@ 1090-1106 (lines=17) @@
1087
     * @param string $paymentUniqueId
1088
     * @return bool
1089
     */
1090
    protected function checkKlarnaOrderExistsByReservation($transactionId) {
1091
        $sql = '
1092
            SELECT * FROM s_order
1093
            WHERE transactionID=?
1094
        ';
1095
        
1096
        $order = Shopware()->Db()->fetchAll($sql, array(
1097
                $transactionId
1098
        ));
1099
        
1100
        $orderExists = (empty($order)) ? false : true;
1101
        $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderExistsByReservation:",3);   
1102
        if ($orderExists){
1103
            $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderExistsByReservation: Order Found: ",3, $order);   
1104
        }
1105
        return $orderExists;
1106
    }    
1107
    
1108
    /**
1109
     * Method checks if certain klarna order exists or not
@@ 1140-1157 (lines=18) @@
1137
     * @param string $sessionID
1138
     * @return bool
1139
     */
1140
    protected function checkKlarnaOrderDetailsBySession($sessionID) {
1141
        $sql = '
1142
            SELECT * FROM s_order
1143
            LEFT JOIN s_order_details ON s_order.id = s_order_details.orderID
1144
            WHERE userID=?
1145
        ';
1146
        
1147
        $orderDetails = Shopware()->Db()->fetchAll($sql, array(
1148
                $sessionID
1149
        ));
1150
        
1151
        $orderExists = (empty($orderDetails)) ? false : true;
1152
        $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderDetailsBySession:",3);   
1153
        if ($orderExists){
1154
            $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderDetailsBySession: OrderDetails Found: ",3, $orderDetails);
1155
        }
1156
        return $orderExists;
1157
    }
1158
    
1159
    /**
1160
     * Method checks if certain klarna order exists or not