@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | */ |
14 | 14 | public function up() |
15 | 15 | { |
16 | - Schema::table('tagging_tags', function (Blueprint $table) { |
|
16 | + Schema::table('tagging_tags', function(Blueprint $table) { |
|
17 | 17 | $table->string('locale', 5)->nullable(); |
18 | 18 | }); |
19 | 19 | } |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | */ |
26 | 26 | public function down() |
27 | 27 | { |
28 | - Schema::table('tagging_tags', function (Blueprint $table) { |
|
28 | + Schema::table('tagging_tags', function(Blueprint $table) { |
|
29 | 29 | $table->dropColumn('locale'); |
30 | 30 | }); |
31 | 31 | } |
@@ -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'); |
@@ -231,14 +231,14 @@ discard block |
||
231 | 231 | */ |
232 | 232 | public static function decrementCount($tagString, $tagSlug, $count) |
233 | 233 | { |
234 | - if($count <= 0) { return; } |
|
234 | + if ($count <= 0) { return; } |
|
235 | 235 | $model = static::tagModelString(); |
236 | 236 | |
237 | 237 | $tag = $model::where('slug', '=', $tagSlug)->first(); |
238 | 238 | |
239 | - if($tag) { |
|
239 | + if ($tag) { |
|
240 | 240 | $tag->count = $tag->count - $count; |
241 | - if($tag->count < 0) { |
|
241 | + if ($tag->count < 0) { |
|
242 | 242 | $tag->count = 0; |
243 | 243 | \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."); |
244 | 244 | } |
@@ -43,13 +43,13 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public static function bootTaggable() |
45 | 45 | { |
46 | - if(static::untagOnDelete()) { |
|
46 | + if (static::untagOnDelete()) { |
|
47 | 47 | static::deleting(function($model) { |
48 | 48 | $model->untag(); |
49 | 49 | }); |
50 | 50 | } |
51 | 51 | |
52 | - static::saved(function ($model) { |
|
52 | + static::saved(function($model) { |
|
53 | 53 | $model->autoTagPostSave(); |
54 | 54 | }); |
55 | 55 | } |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | */ |
76 | 76 | public function getTagsAttribute() |
77 | 77 | { |
78 | - return $this->tagged->map(function(Tagged $item){ |
|
78 | + return $this->tagged->map(function(Tagged $item) { |
|
79 | 79 | return $item->tag; |
80 | 80 | }); |
81 | 81 | } |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | */ |
120 | 120 | public function tagNames(): array |
121 | 121 | { |
122 | - return $this->tagged->map(function($item){ |
|
122 | + return $this->tagged->map(function($item) { |
|
123 | 123 | return $item->tag_name; |
124 | 124 | })->toArray(); |
125 | 125 | } |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | */ |
132 | 132 | public function tagSlugs(): array |
133 | 133 | { |
134 | - return $this->tagged->map(function($item){ |
|
134 | + return $this->tagged->map(function($item) { |
|
135 | 135 | return $item->tag_slug; |
136 | 136 | })->toArray(); |
137 | 137 | } |
@@ -143,17 +143,17 @@ discard block |
||
143 | 143 | */ |
144 | 144 | public function untag($tagNames = null) |
145 | 145 | { |
146 | - if(is_null($tagNames)) { |
|
146 | + if (is_null($tagNames)) { |
|
147 | 147 | $tagNames = $this->tagNames(); |
148 | 148 | } |
149 | 149 | |
150 | 150 | $tagNames = TaggingUtility::makeTagArray($tagNames); |
151 | 151 | |
152 | - foreach($tagNames as $tagName) { |
|
152 | + foreach ($tagNames as $tagName) { |
|
153 | 153 | $this->removeSingleTag($tagName); |
154 | 154 | } |
155 | 155 | |
156 | - if(static::shouldDeleteUnused()) { |
|
156 | + if (static::shouldDeleteUnused()) { |
|
157 | 157 | TaggingUtility::deleteUnusedTags(); |
158 | 158 | } |
159 | 159 | } |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | |
174 | 174 | $this->untag($deletions); |
175 | 175 | |
176 | - foreach($additions as $tagName) { |
|
176 | + foreach ($additions as $tagName) { |
|
177 | 177 | $this->addSingleTag($tagName); |
178 | 178 | } |
179 | 179 | } |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | */ |
189 | 189 | public function scopeWithAllTags(Builder $query, $tagNames): Builder |
190 | 190 | { |
191 | - if(!is_array($tagNames)) { |
|
191 | + if (!is_array($tagNames)) { |
|
192 | 192 | $tagNames = func_get_args(); |
193 | 193 | array_shift($tagNames); |
194 | 194 | } |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | |
198 | 198 | $className = $query->getModel()->getMorphClass(); |
199 | 199 | |
200 | - foreach($tagNames as $tagSlug) { |
|
200 | + foreach ($tagNames as $tagSlug) { |
|
201 | 201 | |
202 | 202 | $model = TaggingUtility::taggedModelString(); |
203 | 203 | |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | |
276 | 276 | $this->tagged()->save($tagged); |
277 | 277 | |
278 | - TaggingUtility::incrementCount($tagName, $tagSlug, 1, $locale); |
|
278 | + TaggingUtility::incrementCount($tagName, $tagSlug, 1, $locale); |
|
279 | 279 | |
280 | 280 | unset($this->relations['tagged']); |
281 | 281 | |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | |
294 | 294 | $tagSlug = TaggingUtility::normalize($tagName); |
295 | 295 | |
296 | - if($count = $this->tagged()->where('tag_slug', '=', $tagSlug)->delete()) { |
|
296 | + if ($count = $this->tagged()->where('tag_slug', '=', $tagSlug)->delete()) { |
|
297 | 297 | TaggingUtility::decrementCount($tagName, $tagSlug, $count); |
298 | 298 | } |
299 | 299 | |
@@ -387,7 +387,7 @@ discard block |
||
387 | 387 | |
388 | 388 | private function assembleTagsForScoping($query, $tagNames) |
389 | 389 | { |
390 | - if(!is_array($tagNames)) { |
|
390 | + if (!is_array($tagNames)) { |
|
391 | 391 | $tagNames = func_get_args(); |
392 | 392 | array_shift($tagNames); |
393 | 393 | } |