]> BookStack Code Mirror - bookstack/blobdiff - app/Entities/Tools/SlugGenerator.php
Applied StyleCI changes, added php/larastan to attribution
[bookstack] / app / Entities / Tools / SlugGenerator.php
index 4501279f2a31d3c367e6a2ce34be9f1afedaf639..52e5700da24b94c9e1e6fb31d744f9958f189834 100644 (file)
@@ -1,4 +1,6 @@
-<?php namespace BookStack\Entities\Tools;
+<?php
+
+namespace BookStack\Entities\Tools;
 
 use BookStack\Entities\Models\BookChild;
 use BookStack\Interfaces\Sluggable;
@@ -6,7 +8,6 @@ use Illuminate\Support\Str;
 
 class SlugGenerator
 {
-
     /**
      * Generate a fresh slug for the given entity.
      * The slug will generated so it does not conflict within the same parent item.
@@ -17,6 +18,7 @@ class SlugGenerator
         while ($this->slugInUse($slug, $model)) {
             $slug .= '-' . Str::random(3);
         }
+
         return $slug;
     }
 
@@ -26,9 +28,10 @@ class SlugGenerator
     protected function formatNameAsSlug(string $name): string
     {
         $slug = Str::slug($name);
-        if ($slug === "") {
+        if ($slug === '') {
             $slug = substr(md5(rand(1, 500)), 0, 5);
         }
+
         return $slug;
     }