Skip to content

Commit

Permalink
Use Laravel Str helpers for case changes
Browse files Browse the repository at this point in the history
Advantage of the string helpers is that they are unicode-safe and adhere to the Laravel standard, thus maximizing compatibility in the future.
  • Loading branch information
jaulz authored Sep 8, 2021
1 parent 4566b83 commit 27611be
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
5 changes: 3 additions & 2 deletions src/Sanitizers/Capitalize.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace ArondeParon\RequestSanitizer\Sanitizers;

use ArondeParon\RequestSanitizer\Contracts\Sanitizer;
use Illuminate\Support\Str;

class Capitalize implements Sanitizer
{
Expand All @@ -12,6 +13,6 @@ class Capitalize implements Sanitizer
*/
public function sanitize($input)
{
return ucfirst($input);
return Str::ucfirst($input);
}
}
}
5 changes: 3 additions & 2 deletions src/Sanitizers/Lowercase.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace ArondeParon\RequestSanitizer\Sanitizers;

use ArondeParon\RequestSanitizer\Contracts\Sanitizer;
use Illuminate\Support\Str;

class Lowercase implements Sanitizer
{
Expand All @@ -12,6 +13,6 @@ class Lowercase implements Sanitizer
*/
public function sanitize($input)
{
return strtolower($input);
return Str::lower($input);
}
}
}
5 changes: 3 additions & 2 deletions src/Sanitizers/Uppercase.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace ArondeParon\RequestSanitizer\Sanitizers;

use ArondeParon\RequestSanitizer\Contracts\Sanitizer;
use Illuminate\Support\Str;

class Uppercase implements Sanitizer
{
Expand All @@ -12,6 +13,6 @@ class Uppercase implements Sanitizer
*/
public function sanitize($input)
{
return strtoupper($input);
return Str::upper($input);
}
}
}

0 comments on commit 27611be

Please sign in to comment.