Code Duplication    Length = 7-8 lines in 2 locations

src/Services/SlugService.php 2 locations

@@ 151-158 (lines=8) @@
148
        $method = $config['method'];
149
        $maxLength = $config['maxLength'];
150
151
        if ($method === null) {
152
            $slugEngine = $this->getSlugEngine($attribute);
153
            $slug = $slugEngine->slugify($source, $separator);
154
        } elseif (is_callable($method)) {
155
            $slug = call_user_func($method, $source, $separator);
156
        } else {
157
            throw new \UnexpectedValueException('Sluggable "method" for ' . get_class($this->model) . ':' . $attribute . ' is not callable nor null.');
158
        }
159
160
        if (is_string($slug) && $maxLength) {
161
            $slug = mb_substr($slug, 0, $maxLength);
@@ 256-262 (lines=7) @@
253
        }
254
255
        $method = $config['uniqueSuffix'];
256
        if ($method === null) {
257
            $suffix = $this->generateSuffix($slug, $separator, $list);
258
        } else if (is_callable($method)) {
259
            $suffix = call_user_func($method, $slug, $separator, $list);
260
        } else {
261
            throw new \UnexpectedValueException('Sluggable "reserved" for ' . get_class($this->model) . ':' . $attribute . ' is not null, an array, or a closure that returns null/array.');
262
        }
263
264
        return $slug . $separator . $suffix;
265
    }