Passed
Push — master ( ca5e33...a928bb )
by Robin
03:01
created
src/helpers.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
 use TopviewDigital\TranslationHelper\Model\VocabCite;
5 5
 use TopviewDigital\TranslationHelper\Service\Translation;
6 6
 
7
-if (! function_exists('array_sort_value')) {
7
+if (!function_exists('array_sort_value')) {
8 8
     function array_sort_value($array, $mode = SORT_LOCALE_STRING)
9 9
     {
10 10
         // SORT_REGULAR - compare items normally (don't change types)
@@ -15,8 +15,8 @@  discard block
 block discarded – undo
15 15
         // SORT_NATURAL - compare items as strings using "natural ordering" like natsort()
16 16
         // SORT_FLAG_CASE
17 17
 
18
-        if (! is_array($array)) {
19
-            $array = method_exists($array, 'toArray') ? $array->toArray() : (array) $array;
18
+        if (!is_array($array)) {
19
+            $array = method_exists($array, 'toArray') ? $array->toArray() : (array)$array;
20 20
         }
21 21
         // \Locale::setDefault(str_replace('-', '_', \App::getLocale()));
22 22
         $keys = array_keys($array);
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
                     }
113 113
                     $code = array_filter(array_slice($lines, $start, $end - $start + 1, true), 'trim');
114 114
                     $max = strlen($end);
115
-                    $cite->code = implode("\n", array_map(function ($u, $v) use ($max) {
115
+                    $cite->code = implode("\n", array_map(function($u, $v) use ($max) {
116 116
                         return sprintf("%{$max}d    %s", $u + 1, rtrim($v));
117 117
                     }, array_keys($code), $code));
118 118
                     $cite->save();
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
     function sweep()
131 131
     {
132 132
         array_map(
133
-            function ($u) {
133
+            function($u) {
134 134
                 $u->sweep();
135 135
             },
136 136
             array_merge(
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
     {
182 182
         $keys = array_keys($slugs);
183 183
         $slugs = array_values($slugs);
184
-        $slugs = array_map(function ($k, $v) use ($slugs) {
184
+        $slugs = array_map(function($k, $v) use ($slugs) {
185 185
             if ($k > 0 && in_array($v, array_slice($slugs, 0, $k - 1))) {
186 186
                 $v .= '-' . uniqid();
187 187
             }
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
                 }
227 227
                 $slugs = unique_slugs($slugs);
228 228
                 $max = intdiv(max(array_map('strlen', $slugs)) + 3, 4) * 4;
229
-                $lines = array_map(function ($u, $v) use ($max) {
229
+                $lines = array_map(function($u, $v) use ($max) {
230 230
                     $u = "'{$u}'";
231 231
                     return sprintf("    %-{$max}s => '%s',", $u, $v);
232 232
                 }, $slugs, $terms);
Please login to merge, or discard this patch.