Completed
Pull Request — master (#362)
by Julien
09:38
created

IdeographicEngine::slugify()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 5
rs 9.4285
cc 1
eloc 3
nc 1
nop 2
1
<?php namespace Cviebrock\EloquentSluggable\Engines;
2
3
use Cocur\Slugify\SlugifyInterface;
4
5
/**
6
 * Class IdeographicEngine
7
 *
8
 * @package Cviebrock\EloquentSluggable\Engines
9
 */
10
class IdeographicEngine implements SlugifyInterface
11
{
12
13
14
    /**
15
     * For ideographic Engine, Return a unique Random string instead of Slug
16
     *
17
     * @param string $string
18
     * @param string|array|null $options
19
     *
20
     * @return string
21
     *
22
     * @api
23
     */
24
    public function slugify($string, $options = null)
25
    {
26
        $fullString = md5(uniqid(rand(), true));
27
        return substr($fullString, 0, 12);
28
    }
29
}
30