Code Duplication    Length = 9-9 lines in 3 locations

core/modules/node/model/NodeModel.php 1 location

@@ 489-497 (lines=9) @@
486
        $this->slug = $this->_makeSlug();
487
    }
488
489
    private function _sluggify($name)
490
    {
491
        // @see http://stackoverflow.com/a/5240834
492
        $slug = iconv('UTF-8', 'ASCII//TRANSLIT', $name);
493
        $slug = preg_replace("/[^a-zA-Z0-9\/_| -]/", '', $name);
494
        $slug = strtolower(trim($slug, '-'));
495
        $slug = preg_replace("/[\/_| -]+/", '-', $slug);
496
497
        return $slug;
498
    }
499
500
    public function loadBySlug($slug, $publishedCheck = false)

core/modules/shop/model/ProductModel.php 1 location

@@ 156-164 (lines=9) @@
153
        return $slug;
154
    }
155
156
    private function _sluggify($name)
157
    {
158
        // @see http://stackoverflow.com/a/5240834
159
        $slug = iconv('UTF-8', 'ASCII//TRANSLIT', $name);
160
        $slug = preg_replace("/[^a-zA-Z0-9\/_| -]/", '', $name);
161
        $slug = strtolower(trim($slug, '-'));
162
        $slug = preg_replace("/[\/_| -]+/", '-', $slug);
163
164
        return $slug;
165
    }
166
167
    /**

lib/Ajde/Crud/Export/excel.lib.php 1 location

@@ 25-33 (lines=9) @@
22
     *
23
     * @return string The file safe title
24
     */
25
    public static function filename($title)
26
    {
27
        $result = strtolower(trim($title));
28
        $result = str_replace("'", '', $result);
29
        $result = preg_replace('#[^a-z0-9_]+#', '-', $result);
30
        $result = preg_replace('#\-{2,}#', '-', $result);
31
32
        return preg_replace('#(^\-+|\-+$)#D', '', $result);
33
    }
34
35
    /**
36
     * Builds a new Excel Spreadsheet object.