@@ -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('taggable.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', |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | $str = preg_replace('/[^\p{L}\p{Nd}]+/u', $options['delimiter'], $str); |
181 | 181 | |
182 | 182 | // Remove duplicate delimiters |
183 | - $str = preg_replace('/(' . preg_quote($options['delimiter'], '/') . '){2,}/', '$1', $str); |
|
183 | + $str = preg_replace('/('.preg_quote($options['delimiter'], '/').'){2,}/', '$1', $str); |
|
184 | 184 | |
185 | 185 | // Truncate slug to max. characters |
186 | 186 | $str = mb_substr($str, 0, ($options['limit'] ? $options['limit'] : mb_strlen($str, 'UTF-8')), 'UTF-8'); |
@@ -201,12 +201,12 @@ discard block |
||
201 | 201 | */ |
202 | 202 | public static function incrementCount($tagString, $tagSlug, $count) |
203 | 203 | { |
204 | - if($count <= 0) { return; } |
|
204 | + if ($count <= 0) { return; } |
|
205 | 205 | $model = static::tagModelString(); |
206 | 206 | |
207 | 207 | $tag = $model::where('slug', '=', $tagSlug)->first(); |
208 | 208 | |
209 | - if(!$tag) { |
|
209 | + if (!$tag) { |
|
210 | 210 | $tag = new $model; |
211 | 211 | $tag->name = $tagString; |
212 | 212 | $tag->slug = $tagSlug; |
@@ -226,14 +226,14 @@ discard block |
||
226 | 226 | */ |
227 | 227 | public static function decrementCount($tagString, $tagSlug, $count) |
228 | 228 | { |
229 | - if($count <= 0) { return; } |
|
229 | + if ($count <= 0) { return; } |
|
230 | 230 | $model = static::tagModelString(); |
231 | 231 | |
232 | 232 | $tag = $model::where('slug', '=', $tagSlug)->first(); |
233 | 233 | |
234 | - if($tag) { |
|
234 | + if ($tag) { |
|
235 | 235 | $tag->count = $tag->count - $count; |
236 | - if($tag->count < 0) { |
|
236 | + if ($tag->count < 0) { |
|
237 | 237 | $tag->count = 0; |
238 | 238 | \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."); |
239 | 239 | } |