Code Duplication    Length = 7-7 lines in 2 locations

src/Charcoal/Object/RoutableTrait.php 2 locations

@@ 652-658 (lines=7) @@
649
    protected function finalizeSlug($slug)
650
    {
651
        $prefix = $this->slugPrefix();
652
        if ($prefix) {
653
            $prefix = $this->generateRoutePattern((string)$prefix);
654
            if ($slug === $prefix) {
655
                throw new \UnexpectedValueException('The slug is the same as the prefix.');
656
            }
657
            $slug = $prefix.preg_replace('!^'.preg_quote($prefix).'\b!', '', $slug);
658
        }
659
660
        $suffix = $this->slugSuffix();
661
        if ($suffix) {
@@ 661-667 (lines=7) @@
658
        }
659
660
        $suffix = $this->slugSuffix();
661
        if ($suffix) {
662
            $suffix = $this->generateRoutePattern((string)$suffix);
663
            if ($slug === $suffix) {
664
                throw new \UnexpectedValueException('The slug is the same as the suffix.');
665
            }
666
            $slug = preg_replace('!\b'.preg_quote($suffix).'$!', '', $slug).$suffix;
667
        }
668
669
        return $slug;
670
    }