Code Duplication    Length = 7-8 lines in 2 locations

src/Services/SlugService.php 2 locations

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