Code Duplication    Length = 17-21 lines in 2 locations

system/libraries/Database.php 2 locations

@@ 314-334 (lines=21) @@
311
            $sql = array($sql);
312
        }
313
314
        foreach ($sql as $val) {
315
            if (is_string($val)) {
316
                if (($val = trim($val)) === '') {
317
                    continue;
318
                }
319
320
                // TODO: Temporary solution, this should be moved to database driver (AS is checked for twice)
321
                if (stripos($val, ' AS ') !== false) {
322
                    $val = str_ireplace(' AS ', ' AS ', $val);
323
324
                    list($table, $alias) = explode(' AS ', $val);
325
326
                    // Attach prefix to both sides of the AS
327
                    $val = $this->config['table_prefix'].$table.' AS '.$this->config['table_prefix'].$alias;
328
                } else {
329
                    $val = $this->config['table_prefix'].$val;
330
                }
331
            }
332
333
            $this->from[] = $val;
334
        }
335
336
        return $this;
337
    }
@@ 383-399 (lines=17) @@
380
            $table = array($table);
381
        }
382
383
        foreach ($table as $t) {
384
            if (is_string($t)) {
385
                // TODO: Temporary solution, this should be moved to database driver (AS is checked for twice)
386
                if (stripos($t, ' AS ') !== false) {
387
                    $t = str_ireplace(' AS ', ' AS ', $t);
388
389
                    list($table, $alias) = explode(' AS ', $t);
390
391
                    // Attach prefix to both sides of the AS
392
                    $t = $this->config['table_prefix'].$table.' AS '.$this->config['table_prefix'].$alias;
393
                } else {
394
                    $t = $this->config['table_prefix'].$t;
395
                }
396
            }
397
398
            $join['tables'][] = $this->driver->escape_column($t);
399
        }
400
401
        $join['conditions'] = '('.trim(implode(' ', $cond)).')';
402
        $join['type'] = $type;