Passed
Pull Request — master (#82)
by
unknown
46s
created
src/Code/Converters/LrcConverter.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
             }
37 37
         }
38 38
 
39
-        usort($internal_format, function ($a, $b) {
39
+        usort($internal_format, function($a, $b) {
40 40
             return $a['start'] <=> $b['start'];
41 41
         });
42 42
 
@@ -74,18 +74,18 @@  discard block
 block discarded – undo
74 74
     {
75 75
         $parts = explode(':', $lrc_time);
76 76
         if (count($parts) === 3) {
77
-            $minutes = (int) $parts[0];
78
-            $seconds = (float) $parts[1];
77
+            $minutes = (int)$parts[0];
78
+            $seconds = (float)$parts[1];
79 79
             $milliseconds = str_pad($parts[2], 3, '0', STR_PAD_RIGHT);
80 80
         } else if (count($parts) === 2) {
81
-            $minutes = (int) $parts[0];
82
-            $seconds = (float) $parts[1];
81
+            $minutes = (int)$parts[0];
82
+            $seconds = (float)$parts[1];
83 83
             $milliseconds = 0;
84 84
         } else {
85 85
             throw new UserException("$lrc_time timestamp is not valid in .lrc file");
86 86
         }
87 87
 
88
-        return $minutes * 60 + $seconds + (float) ('.' . $milliseconds) - $timestamp_offset;
88
+        return $minutes * 60 + $seconds + (float)('.' . $milliseconds) - $timestamp_offset;
89 89
     }
90 90
 
91 91
     protected static function internalTimeToLrc($internal_time) : string
@@ -107,9 +107,9 @@  discard block
 block discarded – undo
107 107
     {
108 108
         $timestamp_offset = 0;
109 109
         if (preg_match(self::$time_offset_regexp, $content, $match)) {
110
-            $factor = (int) $match[1] < 0 ? -1 : 1;
111
-            $offset = abs((int) $match[1]);
112
-            $timestamp_offset = ((int) ($offset / 1000) + (float) ('.' . $offset % 1000)) * $factor;
110
+            $factor = (int)$match[1] < 0 ? -1 : 1;
111
+            $offset = abs((int)$match[1]);
112
+            $timestamp_offset = ((int)($offset / 1000) + (float)('.' . $offset % 1000)) * $factor;
113 113
         }
114 114
 
115 115
         return $timestamp_offset;
Please login to merge, or discard this patch.
src/Code/Converters/TxtConverter.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
                 }
110 110
             }
111 111
 
112
-            $internal_format[$j] =  [
112
+            $internal_format[$j] = [
113 113
                 'start' => $row['start'],
114 114
                 'end' => $row['end'],
115 115
                 'lines' => [$row['text']],
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
         }
213 213
 
214 214
         // sort times
215
-        usort($internal_format, function ($a, $b) {
215
+        usort($internal_format, function($a, $b) {
216 216
             if ($a['start'] === $b['start']) {
217 217
                 return $a['end'] <=> $b['end'];
218 218
             }
@@ -288,23 +288,23 @@  discard block
 block discarded – undo
288 288
         return $matches;
289 289
     }
290 290
 
291
-    public static function timeToInternal(string $time, int|null $fps)
291
+    public static function timeToInternal(string $time, int | null $fps)
292 292
     {
293 293
         $time = trim($time);
294 294
         $time_parts = explode(':', $time);
295 295
         $total_parts = count($time_parts);
296 296
 
297 297
         if ($total_parts === 1) {
298
-            $tmp = (float) str_replace(',', '.', $time_parts[0]);
298
+            $tmp = (float)str_replace(',', '.', $time_parts[0]);
299 299
             return $tmp;
300 300
         } elseif ($total_parts === 2) { // minutes:seconds format
301 301
             list($minutes, $seconds) = array_map('intval', $time_parts);
302
-            $tmp = (float) str_replace(',', '.', $time_parts[1]);
302
+            $tmp = (float)str_replace(',', '.', $time_parts[1]);
303 303
             $milliseconds = $tmp - floor($tmp);
304 304
             return ($minutes * 60) + $seconds + $milliseconds;
305 305
         } elseif ($total_parts === 3) { // hours:minutes:seconds,milliseconds format
306 306
             list($hours, $minutes, $seconds) = array_map('intval', $time_parts);
307
-            $tmp = (float) str_replace(',', '.', $time_parts[2]);
307
+            $tmp = (float)str_replace(',', '.', $time_parts[2]);
308 308
             $milliseconds = $tmp - floor($tmp);
309 309
             return ($hours * 3600) + ($minutes * 60) + $seconds + $milliseconds;
310 310
         } elseif ($total_parts === 4) { // hours:minutes:seconds:frames format
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
             return $subject;
342 342
         }
343 343
 
344
-        $result = strstr($subject, (string) $search, true);
344
+        $result = strstr($subject, (string)$search, true);
345 345
 
346 346
         return $result === false ? $subject : $result;
347 347
     }
Please login to merge, or discard this patch.