Code Duplication    Length = 17-17 lines in 2 locations

lib/Book.php 2 locations

@@ 212-228 (lines=17) @@
209
    /**
210
     * @return Tag[]
211
     */
212
    public function getTags() {
213
        if (is_null ($this->tags)) {
214
            $this->tags = array();
215
216
            $result = parent::getDb()->prepare('select tags.id as id, name
217
                from books_tags_link, tags
218
                where tag = tags.id
219
                and book = ?
220
                order by name');
221
            $result->execute(array($this->id));
222
            while ($post = $result->fetchObject())
223
            {
224
                array_push($this->tags, new Tag($post));
225
            }
226
        }
227
        return $this->tags;
228
    }
229
230
    public function getTagsName() {
231
        return implode(', ', array_map(function ($tag) { return $tag->name; }, $this->getTags()));
@@ 238-254 (lines=17) @@
235
    /**
236
     * @return Identifiers[]
237
     */
238
    public function getIdentifiers() {
239
        if (is_null ($this->identifiers)) {
240
            $this->identifiers = array();
241
242
            $result = parent::getDb()->prepare('select type, val, id
243
                from identifiers
244
                where book = ?
245
                order by type');
246
            $result->execute(array($this->id));
247
            while ($post = $result->fetchObject())
248
            {
249
                array_push($this->identifiers, new Identifier($post));
250
            }
251
            
252
        }
253
        return $this->identifiers;
254
    }
255
256
    /**
257
     * @return Data[]