Code Duplication    Length = 14-14 lines in 2 locations

src/Model/Blog.php 2 locations

@@ 136-149 (lines=14) @@
133
     * @param bool $hideEmpty Set to false to include tags without posts
134
     * @return DataList|BlogTag[]
135
     */
136
    public function Tags($hideEmpty = true)
137
    {
138
        $tags = BlogTag::get()->setDataQueryParam('BlogID', $this->ID);
139
140
        // Conditionally hide empty tags
141
        if ($this->ID && $hideEmpty) {
142
            $tags = $tags->filter([
143
                'BlogPosts.ParentID' => $this->ID,
144
            ]);
145
        }
146
147
        $this->extend('updateBlogTags', $tags);
148
        return $tags;
149
    }
150
151
    /**
152
     * Gets the list of all categories attached to this blog
@@ 157-170 (lines=14) @@
154
     * @param bool $hideEmpty Set to false to include categories without posts
155
     * @return DataList|BlogCategory[]
156
     */
157
    public function Categories($hideEmpty = true)
158
    {
159
        $tags = BlogCategory::get()->setDataQueryParam('BlogID', $this->ID);
160
161
        // Conditionally hide empty categories
162
        if ($this->ID && $hideEmpty) {
163
            $tags = $tags->filter([
164
                'BlogPosts.ParentID' => $this->ID,
165
            ]);
166
        }
167
168
        $this->extend('updateBlogCategories', $tags);
169
        return $tags;
170
    }
171
172
    /**
173
     * {@inheritdoc}