Code Duplication    Length = 17-18 lines in 4 locations

Controllers/Frontend/PaymentKlarna.php 4 locations

@@ 1106-1122 (lines=17) @@
1103
     * @param string $sessionID
1104
     * @return bool
1105
     */
1106
    protected function checkKlarnaOrderExistsBySession($sessionID)
1107
    {
1108
        $sql = '
1109
            SELECT * FROM s_order
1110
            WHERE userID=?
1111
        ';
1112
        
1113
        $order = Shopware()->Db()->fetchAll($sql, [
1114
                $sessionID
1115
        ]);
1116
        
1117
        $orderExists = (empty($order)) ? false : true;
1118
        $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderExistsBySession:", 3);
1119
        if ($orderExists) {
1120
            $this->plugin->klarnaLog(
1121
                "Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderExistsBySession: Order Found: ",
1122
                3,
1123
                $order
1124
            );
1125
        }
@@ 1136-1152 (lines=17) @@
1133
     * @return bool
1134
     * @internal param string $transactionId
1135
     */
1136
    protected function checkKlarnaOrderExistsByReference($paymentUniqueId)
1137
    {
1138
        $sql = '
1139
            SELECT * FROM s_order
1140
            WHERE temporaryID=?
1141
        ';
1142
        
1143
        $order = Shopware()->Db()->fetchAll($sql, [
1144
                $paymentUniqueId
1145
        ]);
1146
        
1147
        $orderExists = (empty($order)) ? false : true;
1148
        $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderExistsByReference:", 3);
1149
        if ($orderExists) {
1150
            $this->plugin->klarnaLog(
1151
                "Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderExistsByReference: Order Found: ",
1152
                3,
1153
                $order
1154
            );
1155
        }
@@ 1166-1182 (lines=17) @@
1163
     * @return bool
1164
     * @internal param string $paymentUniqueId
1165
     */
1166
    protected function checkKlarnaOrderExistsByReservation($transactionId)
1167
    {
1168
        $sql = '
1169
            SELECT * FROM s_order
1170
            WHERE transactionID=?
1171
        ';
1172
        
1173
        $order = Shopware()->Db()->fetchAll($sql, [
1174
                $transactionId
1175
        ]);
1176
        
1177
        $orderExists = (empty($order)) ? false : true;
1178
        $this->plugin->klarnaLog(
1179
            "Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderExistsByReservation:",
1180
            3
1181
        );
1182
        if ($orderExists) {
1183
            $this->plugin->klarnaLog(
1184
                "Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderExistsByReservation: Order Found: ",
1185
                3,
@@ 1225-1242 (lines=18) @@
1222
     * @param string $sessionID
1223
     * @return bool
1224
     */
1225
    protected function checkKlarnaOrderDetailsBySession($sessionID)
1226
    {
1227
        $sql = '
1228
            SELECT * FROM s_order
1229
            LEFT JOIN s_order_details ON s_order.id = s_order_details.orderID
1230
            WHERE userID=?
1231
        ';
1232
        
1233
        $orderDetails = Shopware()->Db()->fetchAll($sql, [
1234
                $sessionID
1235
        ]);
1236
        
1237
        $orderExists = (empty($orderDetails)) ? false : true;
1238
        $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderDetailsBySession:", 3);
1239
        if ($orderExists) {
1240
            $this->plugin->klarnaLog(
1241
                "Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderDetailsBySession: OrderDetails Found: ",
1242
                3,
1243
                $orderDetails
1244
            );
1245
        }