Code Duplication    Length = 7-7 lines in 2 locations

src/Charcoal/Object/RoutableTrait.php 2 locations

@@ 595-601 (lines=7) @@
592
    protected function finalizeSlug($slug)
593
    {
594
        $prefix = $this->slugPrefix();
595
        if ($prefix) {
596
            $prefix = $this->generateRoutePattern((string)$prefix);
597
            if ($slug === $prefix) {
598
                throw new \UnexpectedValueException('The slug is the same as the prefix.');
599
            }
600
            $slug = $prefix.preg_replace('!^'.preg_quote($prefix).'\b!', '', $slug);
601
        }
602
603
        $suffix = $this->slugSuffix();
604
        if ($suffix) {
@@ 604-610 (lines=7) @@
601
        }
602
603
        $suffix = $this->slugSuffix();
604
        if ($suffix) {
605
            $suffix = $this->generateRoutePattern((string)$suffix);
606
            if ($slug === $suffix) {
607
                throw new \UnexpectedValueException('The slug is the same as the suffix.');
608
            }
609
            $slug = preg_replace('!\b'.preg_quote($suffix).'$!', '', $slug).$suffix;
610
        }
611
612
        return $slug;
613
    }