Passed
Push — master ( 4d5347...42ee6f )
by Robert
07:46
created
src/TaggingUtility.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
     public static function slug($str)
67 67
     {
68 68
         // Make sure string is in UTF-8 and strip invalid UTF-8 characters
69
-        $str = mb_convert_encoding((string)$str, 'UTF-8');
69
+        $str = mb_convert_encoding((string) $str, 'UTF-8');
70 70
 
71 71
         $options = [
72 72
             'delimiter' => config('tagging.delimiter', '-'),
@@ -144,11 +144,11 @@  discard block
 block discarded – undo
144 144
                 'Ă' => 'A', 'ă' => 'a', 'Ș' => 'S', 'ș' => 's', 'Ț' => 'T', 'ț' => 't',
145 145
 
146 146
                 //Vietnamese
147
-                'ả' => 'a', 'Ả' => 'A','ạ' => 'a', 'Ạ' => 'A', 'ắ' => 'a', 'Ắ' => 'A', 'ằ' => 'a', 'Ằ' => 'A',
147
+                'ả' => 'a', 'Ả' => 'A', 'ạ' => 'a', 'Ạ' => 'A', 'ắ' => 'a', 'Ắ' => 'A', 'ằ' => 'a', 'Ằ' => 'A',
148 148
                 'ẳ' => 'a', 'Ẳ' => 'A', 'ẵ' => 'a', 'Ẵ' => 'A', 'ặ' => 'a', 'Ặ' => 'A', 'ẩ' => 'a', 'Ẩ' => 'A',
149 149
                 'Ấ' => 'A', 'ấ' => 'a', 'Ầ' => 'A', 'ầ' => 'a', 'Ơ' => 'O', 'ơ' => 'o', 'Đ' => 'D', 'đ' => 'd',
150 150
                 'ẫ' => 'a', 'Ẫ' => 'A', 'ậ' => 'a', 'Ậ' => 'A', 'ẻ' => 'e', 'Ẻ' => 'E', 'ẽ' => 'e', 'Ẽ' => 'E',
151
-                'ẹ' => 'e', 'Ẹ' => 'E', 'ế' => 'e', 'Ế' => 'E', 'ề' => 'e', 'Ề' => 'E',  'ể' => 'e', 'Ể' => 'E',
151
+                'ẹ' => 'e', 'Ẹ' => 'E', 'ế' => 'e', 'Ế' => 'E', 'ề' => 'e', 'Ề' => 'E', 'ể' => 'e', 'Ể' => 'E',
152 152
                 'ễ' => 'e', 'Ễ' => 'E', 'ệ' => 'e', 'Ệ' => 'E', 'ỉ' => 'i', 'Ỉ' => 'I', 'ĩ' => 'i', 'Ĩ' => 'I',
153 153
                 'ị' => 'i', 'Ị' => 'I', 'ỏ' => 'o', 'Ỏ' => 'O', 'ọ' => 'o', 'Ọ' => 'O', 'ố' => 'o', 'Ố' => 'O',
154 154
                 'ồ' => 'o', 'Ồ' => 'O', 'ổ' => 'o', 'Ổ' => 'O', 'ỗ' => 'o', 'Ỗ' => 'O', 'ộ' => 'o', 'Ộ' => 'O',
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
                 //Kurdish
162 162
         'ا' => 'a', 'ب' => 'b', 'ج' => 'c', 'د' => 'd', 'ێ' => 'e', 'ف' => 'f', 'گ' => 'g', 'ژ' => 'j',
163 163
                 'ک' => 'k', 'ل' => 'l', 'م' => 'm', 'ن' => 'n', 'ۆ' => 'o', 'پ' => 'p', 'ق' => 'q', 'ر' => 'r',
164
-                'س' => 's', 'ت' => 't', 'ڤ' => 'v','وو' => 'u', 'و' => 'w', 'خ' => 'x', 'ی' => 'y', 'ز' => 'z',
164
+                'س' => 's', 'ت' => 't', 'ڤ' => 'v', 'وو' => 'u', 'و' => 'w', 'خ' => 'x', 'ی' => 'y', 'ز' => 'z',
165 165
                 'ڕ' => 'rr', 'ە' => 'e', 'ح' => 'hh', 'ع' => '', 'ش' => 'sh', 'غ' => 'gh', 'ك' => 'k', 'ڵ' => 'll',
166 166
                 'چ' => 'ch', 'ھ' => 'h', "ئ" => '', 'ه' => 'e', 'ه' => 'h', 'ص' => 's', 'ي' => 'y', 'ة' => 'e',
167 167
                 'ط' => 't', 'ذ' => 'z', 'ؤ' => 'u', 'ظ' => 'dh', 'ض' => 'dh', 'ث' => 's', 'أ' => 'a', 'إ' => 'i',
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
         $str = preg_replace('/[^\p{L}\p{Nd}]+/u', $options['delimiter'], $str);
180 180
 
181 181
         // Remove duplicate delimiters
182
-        $str = preg_replace('/(' . preg_quote($options['delimiter'], '/') . '){2,}/', '$1', $str);
182
+        $str = preg_replace('/('.preg_quote($options['delimiter'], '/').'){2,}/', '$1', $str);
183 183
 
184 184
         // Truncate slug to max. characters
185 185
         $str = mb_substr($str, 0, ($options['limit'] ? $options['limit'] : mb_strlen($str, 'UTF-8')), 'UTF-8');
Please login to merge, or discard this patch.
src/Taggable.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -43,13 +43,13 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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($tagSlug, $count);
298 298
         }
299 299
 
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
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
         }
Please login to merge, or discard this patch.