Code Duplication    Length = 11-11 lines in 2 locations

lib/CustomColumnTypeEnumeration.php 1 location

@@ 86-96 (lines=11) @@
83
        return str_format(localize("customcolumn.description.enum", $this->getDistinctValueCount()), $this->getDistinctValueCount());
84
    }
85
86
    public function getCustomByBook($book)
87
    {
88
        $queryFormat = "SELECT {0}.id AS id, {0}.{2} AS name FROM {0}, {1} WHERE {0}.id = {1}.{2} AND {1}.book = {3}";
89
        $query = str_format($queryFormat, $this->getTableName(), $this->getTableLinkName(), $this->getTableLinkColumn(), $book->id);
90
91
        $result = Base::getDb()->query($query);
92
        if ($post = $result->fetchObject()) {
93
            return new CustomColumn($post->id, $post->name, $this);
94
        }
95
        return new CustomColumn(NULL, localize("customcolumn.enum.unknown"), $this);
96
    }
97
98
    public function isSearchable()
99
    {

lib/CustomColumnTypeText.php 1 location

@@ 89-99 (lines=11) @@
86
        return $desc;
87
    }
88
89
    public function getCustomByBook($book)
90
    {
91
        $queryFormat = "SELECT {0}.id AS id, {0}.{2} AS name FROM {0}, {1} WHERE {0}.id = {1}.{2} AND {1}.book = {3} ORDER BY {0}.value";
92
        $query = str_format($queryFormat, $this->getTableName(), $this->getTableLinkName(), $this->getTableLinkColumn(), $book->id);
93
94
        $result = Base::getDb()->query($query);
95
        if ($post = $result->fetchObject()) {
96
            return new CustomColumn($post->id, $post->name, $this);
97
        }
98
        return new CustomColumn(NULL, "", $this);
99
    }
100
101
    public function isSearchable()
102
    {