@@ -20,13 +20,13 @@ discard block |
||
20 | 20 | */ |
21 | 21 | public static function makeTagArray($tagNames) |
22 | 22 | { |
23 | - if(is_array($tagNames) && count($tagNames) == 1) { |
|
23 | + if (is_array($tagNames) && count($tagNames) == 1) { |
|
24 | 24 | $tagNames = reset($tagNames); |
25 | 25 | } |
26 | 26 | |
27 | - if(is_string($tagNames)) { |
|
27 | + if (is_string($tagNames)) { |
|
28 | 28 | $tagNames = explode(',', $tagNames); |
29 | - } elseif(!is_array($tagNames)) { |
|
29 | + } elseif (!is_array($tagNames)) { |
|
30 | 30 | $tagNames = array(null); |
31 | 31 | } |
32 | 32 | |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | { |
48 | 48 | $normalizer = config('tagging.normalizer'); |
49 | 49 | |
50 | - if(is_string($normalizer) && Str::contains($normalizer, 'Conner\Tagging\Util')) { |
|
50 | + if (is_string($normalizer) && Str::contains($normalizer, 'Conner\Tagging\Util')) { |
|
51 | 51 | $normalizer = '\Conner\Tagging\TaggingUtility::slug'; |
52 | 52 | } |
53 | 53 | |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | public static function slug($str) |
70 | 70 | { |
71 | 71 | // Make sure string is in UTF-8 and strip invalid UTF-8 characters |
72 | - $str = mb_convert_encoding((string)$str, 'UTF-8'); |
|
72 | + $str = mb_convert_encoding((string) $str, 'UTF-8'); |
|
73 | 73 | |
74 | 74 | $options = [ |
75 | 75 | 'delimiter' => config('tagging.delimiter', '-'), |
@@ -147,11 +147,11 @@ discard block |
||
147 | 147 | 'Ă' => 'A', 'ă' => 'a', 'Ș' => 'S', 'ș' => 's', 'Ț' => 'T', 'ț' => 't', |
148 | 148 | |
149 | 149 | //Vietnamese |
150 | - 'ả' => 'a', 'Ả' => 'A','ạ' => 'a', 'Ạ' => 'A', 'ắ' => 'a', 'Ắ' => 'A', 'ằ' => 'a', 'Ằ' => 'A', |
|
150 | + 'ả' => 'a', 'Ả' => 'A', 'ạ' => 'a', 'Ạ' => 'A', 'ắ' => 'a', 'Ắ' => 'A', 'ằ' => 'a', 'Ằ' => 'A', |
|
151 | 151 | 'ẳ' => 'a', 'Ẳ' => 'A', 'ẵ' => 'a', 'Ẵ' => 'A', 'ặ' => 'a', 'Ặ' => 'A', 'ẩ' => 'a', 'Ẩ' => 'A', |
152 | 152 | 'Ấ' => 'A', 'ấ' => 'a', 'Ầ' => 'A', 'ầ' => 'a', 'Ơ' => 'O', 'ơ' => 'o', 'Đ' => 'D', 'đ' => 'd', |
153 | 153 | 'ẫ' => 'a', 'Ẫ' => 'A', 'ậ' => 'a', 'Ậ' => 'A', 'ẻ' => 'e', 'Ẻ' => 'E', 'ẽ' => 'e', 'Ẽ' => 'E', |
154 | - 'ẹ' => 'e', 'Ẹ' => 'E', 'ế' => 'e', 'Ế' => 'E', 'ề' => 'e', 'Ề' => 'E', 'ể' => 'e', 'Ể' => 'E', |
|
154 | + 'ẹ' => 'e', 'Ẹ' => 'E', 'ế' => 'e', 'Ế' => 'E', 'ề' => 'e', 'Ề' => 'E', 'ể' => 'e', 'Ể' => 'E', |
|
155 | 155 | 'ễ' => 'e', 'Ễ' => 'E', 'ệ' => 'e', 'Ệ' => 'E', 'ỉ' => 'i', 'Ỉ' => 'I', 'ĩ' => 'i', 'Ĩ' => 'I', |
156 | 156 | 'ị' => 'i', 'Ị' => 'I', 'ỏ' => 'o', 'Ỏ' => 'O', 'ọ' => 'o', 'Ọ' => 'O', 'ố' => 'o', 'Ố' => 'O', |
157 | 157 | 'ồ' => 'o', 'Ồ' => 'O', 'ổ' => 'o', 'Ổ' => 'O', 'ỗ' => 'o', 'Ỗ' => 'O', 'ộ' => 'o', 'Ộ' => 'O', |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | //Kurdish |
165 | 165 | 'ا' => 'a', 'ب' => 'b', 'ج' => 'c', 'د' => 'd', 'ێ' => 'e', 'ف' => 'f', 'گ' => 'g', 'ژ' => 'j', |
166 | 166 | 'ک' => 'k', 'ل' => 'l', 'م' => 'm', 'ن' => 'n', 'ۆ' => 'o', 'پ' => 'p', 'ق' => 'q', 'ر' => 'r', |
167 | - 'س' => 's', 'ت' => 't', 'ڤ' => 'v','وو' => 'u', 'و' => 'w', 'خ' => 'x', 'ی' => 'y', 'ز' => 'z', |
|
167 | + 'س' => 's', 'ت' => 't', 'ڤ' => 'v', 'وو' => 'u', 'و' => 'w', 'خ' => 'x', 'ی' => 'y', 'ز' => 'z', |
|
168 | 168 | 'ڕ' => 'rr', 'ە' => 'e', 'ح' => 'hh', 'ع' => '', 'ش' => 'sh', 'غ' => 'gh', 'ك' => 'k', 'ڵ' => 'll', |
169 | 169 | 'چ' => 'ch', 'ھ' => 'h', "ئ" => '', 'ه' => 'e', 'ه' => 'h', 'ص' => 's', 'ي' => 'y', 'ة' => 'e', |
170 | 170 | 'ط' => 't', 'ذ' => 'z', 'ؤ' => 'u', 'ظ' => 'dh', 'ض' => 'dh', 'ث' => 's', 'أ' => 'a', 'إ' => 'i', |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | $str = preg_replace('/[^\p{L}\p{Nd}]+/u', $options['delimiter'], $str); |
183 | 183 | |
184 | 184 | // Remove duplicate delimiters |
185 | - $str = preg_replace('/(' . preg_quote($options['delimiter'], '/') . '){2,}/', '$1', $str); |
|
185 | + $str = preg_replace('/('.preg_quote($options['delimiter'], '/').'){2,}/', '$1', $str); |
|
186 | 186 | |
187 | 187 | // Truncate slug to max. characters |
188 | 188 | $str = mb_substr($str, 0, ($options['limit'] ? $options['limit'] : mb_strlen($str, 'UTF-8')), 'UTF-8'); |
@@ -203,12 +203,12 @@ discard block |
||
203 | 203 | */ |
204 | 204 | public static function incrementCount($tagString, $tagSlug, $count) |
205 | 205 | { |
206 | - if($count <= 0) { return; } |
|
206 | + if ($count <= 0) { return; } |
|
207 | 207 | $model = static::tagModelString(); |
208 | 208 | |
209 | 209 | $tag = $model::where('slug', '=', $tagSlug)->first(); |
210 | 210 | |
211 | - if(!$tag) { |
|
211 | + if (!$tag) { |
|
212 | 212 | $tag = new $model; |
213 | 213 | $tag->name = $tagString; |
214 | 214 | $tag->slug = $tagSlug; |
@@ -228,14 +228,14 @@ discard block |
||
228 | 228 | */ |
229 | 229 | public static function decrementCount($tagString, $tagSlug, $count) |
230 | 230 | { |
231 | - if($count <= 0) { return; } |
|
231 | + if ($count <= 0) { return; } |
|
232 | 232 | $model = static::tagModelString(); |
233 | 233 | |
234 | 234 | $tag = $model::where('slug', '=', $tagSlug)->first(); |
235 | 235 | |
236 | - if($tag) { |
|
236 | + if ($tag) { |
|
237 | 237 | $tag->count = $tag->count - $count; |
238 | - if($tag->count < 0) { |
|
238 | + if ($tag->count < 0) { |
|
239 | 239 | $tag->count = 0; |
240 | 240 | \Log::warning("The '.$model.' count for `$tag->name` was a negative number. This probably means your data got corrupted. Please assess your code and report an issue if you find one."); |
241 | 241 | } |