Code Duplication    Length = 17-18 lines in 4 locations

Controllers/Frontend/PaymentKlarna.php 4 locations

@@ 1185-1201 (lines=17) @@
1182
     * @param string $sessionID
1183
     * @return bool
1184
     */
1185
    protected function checkKlarnaOrderExistsBySession($sessionID)
1186
    {
1187
        $sql = '
1188
            SELECT * FROM s_order
1189
            WHERE userID=?
1190
        ';
1191
        
1192
        $order = Shopware()->Db()->fetchAll($sql, [
1193
                $sessionID,
1194
        ]);
1195
        
1196
        $orderExists = (empty($order)) ? false : true;
1197
        $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderExistsBySession:", 3);
1198
        if ($orderExists) {
1199
            $this->plugin->klarnaLog(
1200
                "Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderExistsBySession: Order Found: ",
1201
                3,
1202
                $order
1203
            );
1204
        }
@@ 1215-1231 (lines=17) @@
1212
     * @return bool
1213
     * @internal param string $transactionId
1214
     */
1215
    protected function checkKlarnaOrderExistsByReference($paymentUniqueId)
1216
    {
1217
        $sql = '
1218
            SELECT * FROM s_order
1219
            WHERE temporaryID=?
1220
        ';
1221
        
1222
        $order = Shopware()->Db()->fetchAll($sql, [
1223
                $paymentUniqueId,
1224
        ]);
1225
        
1226
        $orderExists = (empty($order)) ? false : true;
1227
        $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderExistsByReference:", 3);
1228
        if ($orderExists) {
1229
            $this->plugin->klarnaLog(
1230
                "Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderExistsByReference: Order Found: ",
1231
                3,
1232
                $order
1233
            );
1234
        }
@@ 1245-1261 (lines=17) @@
1242
     * @return bool
1243
     * @internal param string $paymentUniqueId
1244
     */
1245
    protected function checkKlarnaOrderExistsByReservation($transactionId)
1246
    {
1247
        $sql = '
1248
            SELECT * FROM s_order
1249
            WHERE transactionID=?
1250
        ';
1251
        
1252
        $order = Shopware()->Db()->fetchAll($sql, [
1253
                $transactionId,
1254
        ]);
1255
        
1256
        $orderExists = (empty($order)) ? false : true;
1257
        $this->plugin->klarnaLog(
1258
            "Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderExistsByReservation:",
1259
            3
1260
        );
1261
        if ($orderExists) {
1262
            $this->plugin->klarnaLog(
1263
                "Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderExistsByReservation: Order Found: ",
1264
                3,
@@ 1304-1321 (lines=18) @@
1301
     * @param string $sessionID
1302
     * @return bool
1303
     */
1304
    protected function checkKlarnaOrderDetailsBySession($sessionID)
1305
    {
1306
        $sql = '
1307
            SELECT * FROM s_order
1308
            LEFT JOIN s_order_details ON s_order.id = s_order_details.orderID
1309
            WHERE userID=?
1310
        ';
1311
        
1312
        $orderDetails = Shopware()->Db()->fetchAll($sql, [
1313
                $sessionID,
1314
        ]);
1315
        
1316
        $orderExists = (empty($orderDetails)) ? false : true;
1317
        $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderDetailsBySession:", 3);
1318
        if ($orderExists) {
1319
            $this->plugin->klarnaLog(
1320
                "Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderDetailsBySession: OrderDetails Found: ",
1321
                3,
1322
                $orderDetails
1323
            );
1324
        }