From: Raphaƫl Gertz Date: Wed, 11 Dec 2019 03:27:39 +0000 (+0100) Subject: Add function parameter and return types X-Git-Tag: 0.1.2~7 X-Git-Url: https://git.rapsys.eu/userbundle/commitdiff_plain/6d9498950edca4438943b8d0c620c129eaf4c101 Add function parameter and return types --- diff --git a/Utils/Slugger.php b/Utils/Slugger.php index 2172515..8a2856d 100644 --- a/Utils/Slugger.php +++ b/Utils/Slugger.php @@ -66,7 +66,7 @@ class Slugger { } //Short the string - public function short($string) { + public function short(string $string): string { //Return string $ret = ''; @@ -83,7 +83,7 @@ class Slugger { } //Unshort the string - public function unshort($string) { + public function unshort(string $string): string { //Return string $ret = ''; @@ -98,12 +98,12 @@ class Slugger { } //Crypt and base64uri encode string - public function hash($string) { + public function hash(string $string): string { return str_replace(['+','/'], ['-','_'], base64_encode(crypt($string, $this->secret))); } //Convert string to safe slug - function slug($string) { + function slug(string $string): string { return preg_replace('/[\/_|+ -]+/', '-', strtolower(trim(preg_replace('/[^a-zA-Z0-9\/_|+ -]/', '', str_replace(['\'', '"'], ' ', iconv('UTF-8', 'ASCII//TRANSLIT', $string))), '-'))); } }