Code Duplication    Length = 17-18 lines in 4 locations

Controllers/Frontend/PaymentKlarna.php 4 locations

@@ 1074-1090 (lines=17) @@
1071
     * @param string $sessionID
1072
     * @return bool
1073
     */
1074
    protected function checkKlarnaOrderExistsBySession($sessionID) {
1075
        $sql = '
1076
            SELECT * FROM s_order
1077
            WHERE userID=?
1078
        ';
1079
        
1080
        $order = Shopware()->Db()->fetchAll($sql, array(
1081
                $sessionID
1082
        ));
1083
        
1084
        $orderExists = (empty($order)) ? false : true;
1085
        $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderExistsBySession:",3);   
1086
        if ($orderExists){
1087
            $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderExistsBySession: Order Found: ",3, $order);   
1088
        }
1089
        return $orderExists;
1090
    }    
1091
    
1092
    /**
1093
     * Method checks if certain klarna order exists or not
@@ 1099-1115 (lines=17) @@
1096
     * @param string $paymentUniqueId
1097
     * @return bool
1098
     */
1099
    protected function checkKlarnaOrderExistsByReference($paymentUniqueId) {
1100
        $sql = '
1101
            SELECT * FROM s_order
1102
            WHERE temporaryID=?
1103
        ';
1104
        
1105
        $order = Shopware()->Db()->fetchAll($sql, array(
1106
                $paymentUniqueId
1107
        ));
1108
        
1109
        $orderExists = (empty($order)) ? false : true;
1110
        $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderExistsByReference:",3);   
1111
        if ($orderExists){
1112
            $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderExistsByReference: Order Found: ",3, $order);   
1113
        }
1114
        return $orderExists;
1115
    }
1116
    
1117
    /**
1118
     * Method checks if certain klarna order exists or not
@@ 1124-1140 (lines=17) @@
1121
     * @param string $paymentUniqueId
1122
     * @return bool
1123
     */
1124
    protected function checkKlarnaOrderExistsByReservation($transactionId) {
1125
        $sql = '
1126
            SELECT * FROM s_order
1127
            WHERE transactionID=?
1128
        ';
1129
        
1130
        $order = Shopware()->Db()->fetchAll($sql, array(
1131
                $transactionId
1132
        ));
1133
        
1134
        $orderExists = (empty($order)) ? false : true;
1135
        $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderExistsByReservation:",3);   
1136
        if ($orderExists){
1137
            $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderExistsByReservation: Order Found: ",3, $order);   
1138
        }
1139
        return $orderExists;
1140
    }    
1141
    
1142
    /**
1143
     * Method checks if certain klarna order exists or not
@@ 1174-1191 (lines=18) @@
1171
     * @param string $sessionID
1172
     * @return bool
1173
     */
1174
    protected function checkKlarnaOrderDetailsBySession($sessionID) {
1175
        $sql = '
1176
            SELECT * FROM s_order
1177
            LEFT JOIN s_order_details ON s_order.id = s_order_details.orderID
1178
            WHERE userID=?
1179
        ';
1180
        
1181
        $orderDetails = Shopware()->Db()->fetchAll($sql, array(
1182
                $sessionID
1183
        ));
1184
        
1185
        $orderExists = (empty($orderDetails)) ? false : true;
1186
        $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderDetailsBySession:",3);   
1187
        if ($orderExists){
1188
            $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderDetailsBySession: OrderDetails Found: ",3, $orderDetails);
1189
        }
1190
        return $orderExists;
1191
    }
1192
    
1193
    /**
1194
     * Method checks if certain klarna order exists or not