Code Duplication    Length = 17-18 lines in 4 locations

Controllers/Frontend/PaymentKlarna.php 4 locations

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