Code Duplication    Length = 12-15 lines in 3 locations

src/Model/BlogController.php 3 locations

@@ 111-125 (lines=15) @@
108
     *
109
     * @return null|string
110
     */
111
    public function getCurrentProfileURLSegment()
112
    {
113
        $segment = isset($this->urlParams['Profile'])
114
            ? $this->urlParams['Profile']
115
            : null;
116
        if (!$segment) {
117
            return null;
118
        }
119
120
        // url encode unless it's multibyte (already pre-encoded in the database)
121
        // see https://github.com/silverstripe/silverstripe-cms/pull/2384
122
        return URLSegmentFilter::singleton()->getAllowMultibyte()
123
            ? $segment
124
            : rawurlencode($segment);
125
    }
126
127
    /**
128
     * Get posts related to the current Member profile.
@@ 302-313 (lines=12) @@
299
     *
300
     * @return string|null
301
     */
302
    public function getCurrentTagURLSegment()
303
    {
304
        $segment = isset($this->urlParams['Tag'])
305
            ? $this->urlParams['Tag']
306
            : null;
307
308
        // url encode unless it's multibyte (already pre-encoded in the database)
309
        // see https://github.com/silverstripe/silverstripe-cms/pull/2384
310
        return URLSegmentFilter::singleton()->getAllowMultibyte()
311
            ? $segment
312
            : rawurlencode($segment);
313
    }
314
315
    /**
316
     * Renders the blog posts for a given category.
@@ 367-378 (lines=12) @@
364
     *
365
     * @return string|null
366
     */
367
    public function getCurrentCategoryURLSegment()
368
    {
369
        $segment = isset($this->urlParams['Category'])
370
            ? $this->urlParams['Category']
371
            : null;
372
373
        // url encode unless it's multibyte (already pre-encoded in the database)
374
        // see https://github.com/silverstripe/silverstripe-cms/pull/2384
375
        return URLSegmentFilter::singleton()->getAllowMultibyte()
376
            ? $segment
377
            : rawurlencode($segment);
378
    }
379
380
    /**
381
     * Get the meta title for the current action.