Code Duplication    Length = 19-19 lines in 2 locations

class/FaqHandler.php 2 locations

@@ 235-253 (lines=19) @@
232
        $limit = $start = 0;
233
        $sql   = 'SELECT * FROM ' . $this->db->prefix('smartfaq_faq');
234
235
        if (null !== $criteria && is_subclass_of($criteria, 'CriteriaElement')) {
236
            $whereClause = $criteria->renderWhere();
237
238
            if ('WHERE ()' !== $whereClause) {
239
                $sql .= ' ' . $criteria->renderWhere();
240
                if (!empty($notNullFields)) {
241
                    $sql .= $this->NotNullFieldClause($notNullFields, true);
242
                }
243
            } elseif (!empty($notNullFields)) {
244
                $sql .= ' WHERE ' . $this->NotNullFieldClause($notNullFields);
245
            }
246
            if ('' != $criteria->getSort()) {
247
                $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder();
248
            }
249
            $limit = $criteria->getLimit();
250
            $start = $criteria->getStart();
251
        } elseif (!empty($notNullFields)) {
252
            $sql .= $sql .= ' WHERE ' . $this->NotNullFieldClause($notNullFields);
253
        }
254
255
        //echo "<br>" . $sql . "<br>";
256
        $result = $this->db->query($sql, $limit, $start);
@@ 315-333 (lines=19) @@
312
                            faq.exacturl AS exacturl
313
                FROM ' . $this->db->prefix('smartfaq_faq') . ' AS faq INNER JOIN ' . $this->db->prefix('smartfaq_categories') . ' AS category ON faq.categoryid = category.categoryid ';
314
315
        if (null !== $criteria && is_subclass_of($criteria, 'CriteriaElement')) {
316
            $whereClause = $criteria->renderWhere();
317
318
            if ('WHERE ()' !== $whereClause) {
319
                $sql .= ' ' . $criteria->renderWhere();
320
                if (!empty($notNullFields)) {
321
                    $sql .= $this->NotNullFieldClause($notNullFields, true);
322
                }
323
            } elseif (!empty($notNullFields)) {
324
                $sql .= ' WHERE ' . $this->NotNullFieldClause($notNullFields);
325
            }
326
            if ('' != $criteria->getSort()) {
327
                $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder();
328
            }
329
            $limit = $criteria->getLimit();
330
            $start = $criteria->getStart();
331
        } elseif (!empty($notNullFields)) {
332
            $sql .= $sql .= ' WHERE ' . $this->NotNullFieldClause($notNullFields);
333
        }
334
335
        //echo "<br>" . $sql . "<br>";
336
        $result = $this->db->query($sql, $limit, $start);