Completed
Push — master ( cae095...f2bb96 )
by
unknown
07:49
created

helpers.php ➔ uniqueSlugify()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
ccs 0
cts 1
cp 0
crap 2
rs 10
1
<?php
2
3
use EasySlugger\Slugger;
4
5
if (! function_exists('slugify')) {
6
    /**
7
     * Generate slug
8
     *
9
     * @param  string  $text
10
     * @return string
11
     */
12
    function slugify($text)
13
    {
14
        return Slugger::slugify($text);
15
    }
16
}
17
18
if (! function_exists('uniqueSlugify')) {
19
    /**
20
     * Generate unique slug
21
     *
22
     * @param  string  $text
23
     * @return string
24
     */
25
    function uniqueSlugify($text)
26
    {
27
        return Slugger::uniqueSlugify($text);
28
    }
29
}
30
31
if (! function_exists('transcrud')) {
32
    /**
33
     * Translate string but remove file key if translation not found
34
     *
35
     * @param  string  $text
36
     * @return string
37
     */
38
    function transcrud($text)
39
    {
40 7
        $translation = trans('anavel-crud::models.' . $text);
41
42 7
        return str_replace('anavel-crud::models.', '', $translation);
43
    }
44
}