Code Duplication    Length = 17-18 lines in 4 locations

Controllers/Frontend/PaymentKlarna.php 4 locations

@@ 1095-1111 (lines=17) @@
1092
     * @param string $sessionID
1093
     * @return bool
1094
     */
1095
    protected function checkKlarnaOrderExistsBySession($sessionID)
1096
    {
1097
        $sql = '
1098
            SELECT * FROM s_order
1099
            WHERE userID=?
1100
        ';
1101
        
1102
        $order = Shopware()->Db()->fetchAll($sql, [
1103
                $sessionID
1104
        ]);
1105
        
1106
        $orderExists = (empty($order)) ? false : true;
1107
        $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderExistsBySession:", 3);
1108
        if ($orderExists) {
1109
            $this->plugin->klarnaLog(
1110
                "Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderExistsBySession: Order Found: ",
1111
                3,
1112
                $order
1113
            );
1114
        }
@@ 1125-1141 (lines=17) @@
1122
     * @return bool
1123
     * @internal param string $transactionId
1124
     */
1125
    protected function checkKlarnaOrderExistsByReference($paymentUniqueId)
1126
    {
1127
        $sql = '
1128
            SELECT * FROM s_order
1129
            WHERE temporaryID=?
1130
        ';
1131
        
1132
        $order = Shopware()->Db()->fetchAll($sql, [
1133
                $paymentUniqueId
1134
        ]);
1135
        
1136
        $orderExists = (empty($order)) ? false : true;
1137
        $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderExistsByReference:", 3);
1138
        if ($orderExists) {
1139
            $this->plugin->klarnaLog(
1140
                "Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderExistsByReference: Order Found: ",
1141
                3,
1142
                $order
1143
            );
1144
        }
@@ 1155-1171 (lines=17) @@
1152
     * @return bool
1153
     * @internal param string $paymentUniqueId
1154
     */
1155
    protected function checkKlarnaOrderExistsByReservation($transactionId)
1156
    {
1157
        $sql = '
1158
            SELECT * FROM s_order
1159
            WHERE transactionID=?
1160
        ';
1161
        
1162
        $order = Shopware()->Db()->fetchAll($sql, [
1163
                $transactionId
1164
        ]);
1165
        
1166
        $orderExists = (empty($order)) ? false : true;
1167
        $this->plugin->klarnaLog(
1168
            "Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderExistsByReservation:",
1169
            3
1170
        );
1171
        if ($orderExists) {
1172
            $this->plugin->klarnaLog(
1173
                "Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderExistsByReservation: Order Found: ",
1174
                3,
@@ 1214-1231 (lines=18) @@
1211
     * @param string $sessionID
1212
     * @return bool
1213
     */
1214
    protected function checkKlarnaOrderDetailsBySession($sessionID)
1215
    {
1216
        $sql = '
1217
            SELECT * FROM s_order
1218
            LEFT JOIN s_order_details ON s_order.id = s_order_details.orderID
1219
            WHERE userID=?
1220
        ';
1221
        
1222
        $orderDetails = Shopware()->Db()->fetchAll($sql, [
1223
                $sessionID
1224
        ]);
1225
        
1226
        $orderExists = (empty($orderDetails)) ? false : true;
1227
        $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderDetailsBySession:", 3);
1228
        if ($orderExists) {
1229
            $this->plugin->klarnaLog(
1230
                "Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderDetailsBySession: OrderDetails Found: ",
1231
                3,
1232
                $orderDetails
1233
            );
1234
        }