Code Duplication    Length = 21-21 lines in 2 locations

src/Db/MySqlDb.php 1 location

@@ 611-631 (lines=21) @@
608
     *
609
     * @return array Returns an array of table names with prefixes stripped.
610
     */
611
    protected function getTablenames() {
612
        // Get the table names.
613
        $tables = (array)$this->get(
614
            'information_schema.TABLES',
615
            [
616
                'TABLE_SCHEMA' => $this->getDbName(),
617
                'TABLE_NAME' => [Db::OP_LIKE => addcslashes($this->px, '_%').'%']
618
            ],
619
            [
620
                'columns' => ['TABLE_NAME'],
621
                'escapeTable' => false
622
            ]
623
        );
624
625
        // Strip the table prefixes.
626
        $tables = array_map(function ($name) {
627
            return ltrim_substr($name, $this->px);
628
        }, array_column($tables, 'TABLE_NAME'));
629
630
        return $tables;
631
    }
632
633
    /**
634
     * {@inheritdoc}

src/Db/SqliteDb.php 1 location

@@ 402-422 (lines=21) @@
399
     *
400
     * @return array Returns an array of table names with prefixes stripped.
401
     */
402
    protected function getTablenames() {
403
        // Get the table names.
404
        $tables = (array)$this->get(
405
            'sqlite_master',
406
            [
407
                'type' => 'table',
408
                'name' => [Db::OP_LIKE => addcslashes($this->px, '_%').'%']
409
            ],
410
            [
411
                'columns' => ['name'],
412
                'escapeTable' => false
413
            ]
414
        );
415
416
        // Strip the table prefixes.
417
        $tables = array_map(function ($name) {
418
            return ltrim_substr($name, $this->px);
419
        }, array_column($tables, 'name'));
420
421
        return $tables;
422
    }
423
424
    /**
425
     * {@inheritdoc}