Code Duplication    Length = 20-20 lines in 2 locations

core/src/Database.php 1 location

@@ 18-37 (lines=20) @@
15
     * @return null|string|string[]
16
     * @throws Exceptions\TableNotDefinedException
17
     */
18
    public function replaceFullTableName($tableName, $force = false)
19
    {
20
        $tableName = trim($tableName);
21
        if ((bool)$force === true) {
22
            $result = $this->getFullTableName($tableName);
23
        } elseif (strpos($tableName, '[+prefix+]') !== false) {
24
            $dbase = trim($this->getConfig('database'), '`');
25
            $prefix = $this->getConfig('prefix');
26
27
            $result = preg_replace(
28
                '@\[\+prefix\+\](\w+)@',
29
                '`' . $dbase . '`.`' . $prefix . '$1`',
30
                $tableName
31
            );
32
        } else {
33
            $result = $tableName;
34
        }
35
36
        return $result;
37
    }
38
39
    /**
40
     * {@inheritDoc}

core/vendor/agelxnash/modx-evo-database/src/LegacyDatabase.php 1 location

@@ 53-72 (lines=20) @@
50
     * @return null|string|string[]
51
     * @throws Exceptions\TableNotDefinedException
52
     */
53
    public function replaceFullTableName($tableName, $force = false)
54
    {
55
        $tableName = trim($tableName);
56
        if ((bool)$force === true) {
57
            $result = $this->getFullTableName($tableName);
58
        } elseif (strpos($tableName, '[+prefix+]') !== false) {
59
            $dbase = trim($this->getConfig('database'), '`');
60
            $prefix = $this->getConfig('prefix');
61
62
            $result = preg_replace(
63
                '@\[\+prefix\+\](\w+)@',
64
                '`' . $dbase . '`.`' . $prefix . '$1`',
65
                $tableName
66
            );
67
        } else {
68
            $result = $tableName;
69
        }
70
71
        return $result;
72
    }
73
74
    /**
75
     * {@inheritDoc}