@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | Event::on( |
132 | 132 | CraftVariable::class, |
133 | 133 | CraftVariable::EVENT_INIT, |
134 | - function (Event $event) { |
|
134 | + function(Event $event) { |
|
135 | 135 | /** @var CraftVariable $variable */ |
136 | 136 | $variable = $event->sender; |
137 | 137 | $variable->set('transcoder', TranscoderVariable::class); |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | Event::on( |
150 | 150 | Assets::class, |
151 | 151 | Assets::EVENT_GET_THUMB_PATH, |
152 | - function (AssetThumbEvent $event) { |
|
152 | + function(AssetThumbEvent $event) { |
|
153 | 153 | Craft::debug( |
154 | 154 | 'Assets::EVENT_GET_THUMB_PATH', |
155 | 155 | __METHOD__ |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | Event::on( |
167 | 167 | ClearCaches::class, |
168 | 168 | ClearCaches::EVENT_REGISTER_CACHE_OPTIONS, |
169 | - function (RegisterCacheOptionsEvent $event) { |
|
169 | + function(RegisterCacheOptionsEvent $event) { |
|
170 | 170 | $event->options[] = [ |
171 | 171 | 'key' => 'transcoder', |
172 | 172 | 'label' => Craft::t('transcoder', 'Transcoder caches'), |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | Event::on( |
180 | 180 | Plugins::class, |
181 | 181 | Plugins::EVENT_AFTER_INSTALL_PLUGIN, |
182 | - function (PluginEvent $event) { |
|
182 | + function(PluginEvent $event) { |
|
183 | 183 | if ($event->plugin === $this) { |
184 | 184 | $request = Craft::$app->getRequest(); |
185 | 185 | if ($request->isCpRequest) { |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | Event::on( |
205 | 205 | UrlManager::class, |
206 | 206 | UrlManager::EVENT_REGISTER_SITE_URL_RULES, |
207 | - function (RegisterUrlRulesEvent $event) { |
|
207 | + function(RegisterUrlRulesEvent $event) { |
|
208 | 208 | Craft::debug( |
209 | 209 | 'UrlManager::EVENT_REGISTER_SITE_URL_RULES', |
210 | 210 | __METHOD__ |
@@ -405,7 +405,7 @@ discard block |
||
405 | 405 | $synchronous = $audioOptions['synchronous']; |
406 | 406 | } |
407 | 407 | if (!$synchronous) { |
408 | - $ffmpegCmd .=' 1> '.$progressFile.' 2>&1 & echo $!'; |
|
408 | + $ffmpegCmd .= ' 1> '.$progressFile.' 2>&1 & echo $!'; |
|
409 | 409 | // Make sure there isn't a lockfile for this audio file already |
410 | 410 | $lockFile = sys_get_temp_dir().DIRECTORY_SEPARATOR.$destAudioFile.'.lock'; |
411 | 411 | $oldPid = @file_get_contents($lockFile); |
@@ -430,7 +430,7 @@ discard block |
||
430 | 430 | |
431 | 431 | if ($synchronous) { |
432 | 432 | Craft::info($ffmpegCmd, __METHOD__); |
433 | - $url = $settings['transcoderUrls']['audio'] . $subfolder ?? $settings['transcoderUrls']['default']; |
|
433 | + $url = $settings['transcoderUrls']['audio'].$subfolder ?? $settings['transcoderUrls']['default']; |
|
434 | 434 | $result = Craft::parseEnv($url).$destAudioFile; |
435 | 435 | } else { |
436 | 436 | Craft::info($ffmpegCmd."\nffmpeg PID: ".$pid, __METHOD__); |
@@ -508,7 +508,7 @@ discard block |
||
508 | 508 | && (strpos($summaryResult['videoFrameRate'], '/') !== false) |
509 | 509 | ) { |
510 | 510 | $parts = explode('/', $summaryResult['videoFrameRate']); |
511 | - $summaryResult['videoFrameRate'] = (float)$parts[0] / (float)$parts[1]; |
|
511 | + $summaryResult['videoFrameRate'] = (float) $parts[0] / (float) $parts[1]; |
|
512 | 512 | } |
513 | 513 | $result = $summaryResult; |
514 | 514 | } |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | $filePath = parse_url($url, PHP_URL_PATH); |
69 | 69 | // Remove any relative paths |
70 | 70 | if (!PathHelper::ensurePathIsContained($filePath)) { |
71 | - throw new BadRequestHttpException('Invalid resource path: ' . $filePath); |
|
71 | + throw new BadRequestHttpException('Invalid resource path: '.$filePath); |
|
72 | 72 | } |
73 | 73 | // Only work for `allowedFileExtensions` file extensions |
74 | 74 | $extension = strtolower(pathinfo($filePath, PATHINFO_EXTENSION)); |
@@ -112,12 +112,12 @@ discard block |
||
112 | 112 | |
113 | 113 | // rawDuration is in 00:00:00.00 format. This converts it to seconds. |
114 | 114 | $ar = array_reverse(explode(':', $rawDuration)); |
115 | - $duration = (float)$ar[0]; |
|
115 | + $duration = (float) $ar[0]; |
|
116 | 116 | if (!empty($ar[1])) { |
117 | - $duration += (int)$ar[1] * 60; |
|
117 | + $duration += (int) $ar[1] * 60; |
|
118 | 118 | } |
119 | 119 | if (!empty($ar[2])) { |
120 | - $duration += (int)$ar[2] * 60 * 60; |
|
120 | + $duration += (int) $ar[2] * 60 * 60; |
|
121 | 121 | } |
122 | 122 | } else { |
123 | 123 | $duration = 'unknown'; // with GIF as input, duration is unknown |
@@ -134,12 +134,12 @@ discard block |
||
134 | 134 | |
135 | 135 | //rawTime is in 00:00:00.00 format. This converts it to seconds. |
136 | 136 | $ar = array_reverse(explode(':', $rawTime)); |
137 | - $time = (float)$ar[0]; |
|
137 | + $time = (float) $ar[0]; |
|
138 | 138 | if (!empty($ar[1])) { |
139 | - $time += (int)$ar[1] * 60; |
|
139 | + $time += (int) $ar[1] * 60; |
|
140 | 140 | } |
141 | 141 | if (!empty($ar[2])) { |
142 | - $time += (int)$ar[2] * 60 * 60; |
|
142 | + $time += (int) $ar[2] * 60 * 60; |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | //calculate the progress |
@@ -34,8 +34,8 @@ discard block |
||
34 | 34 | |
35 | 35 | const ASSET_CLASS = TranscoderAsset::class; |
36 | 36 | |
37 | - const CACHE_KEY = 'twigpack-' . self::ASSET_CLASS; |
|
38 | - const CACHE_TAG = 'twigpack-' . self::ASSET_CLASS; |
|
37 | + const CACHE_KEY = 'twigpack-'.self::ASSET_CLASS; |
|
38 | + const CACHE_TAG = 'twigpack-'.self::ASSET_CLASS; |
|
39 | 39 | |
40 | 40 | const DEVMODE_CACHE_DURATION = 1; |
41 | 41 | |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | self::$config['server']['publicPath'] = $baseAssetsUrl; |
103 | 103 | $useDevServer = getenv('NYS_PLUGIN_DEVSERVER'); |
104 | 104 | if ($useDevServer !== false) { |
105 | - self::$config['useDevServer'] = (bool)$useDevServer; |
|
105 | + self::$config['useDevServer'] = (bool) $useDevServer; |
|
106 | 106 | } |
107 | 107 | } |
108 | 108 | |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | public static function registerJsModules(array $modules) |
117 | 117 | { |
118 | 118 | $view = Craft::$app->getView(); |
119 | - foreach($modules as $module) { |
|
119 | + foreach ($modules as $module) { |
|
120 | 120 | $jsModule = self::getModule(self::$config, $module, 'modern'); |
121 | 121 | if ($jsModule) { |
122 | 122 | $view->registerJsFile($jsModule, [ |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | public static function registerCssModules(array $modules) |
137 | 137 | { |
138 | 138 | $view = Craft::$app->getView(); |
139 | - foreach($modules as $module) { |
|
139 | + foreach ($modules as $module) { |
|
140 | 140 | $cssModule = self::getModule(self::$config, $module, 'legacy'); |
141 | 141 | if ($cssModule) { |
142 | 142 | $view->registerCssFile($cssModule, [ |
@@ -363,7 +363,7 @@ discard block |
||
363 | 363 | // Resolve any aliases |
364 | 364 | $alias = Craft::getAlias($path, false); |
365 | 365 | if ($alias) { |
366 | - $path = (string)$alias; |
|
366 | + $path = (string) $alias; |
|
367 | 367 | } |
368 | 368 | // Make sure it's a full URL |
369 | 369 | if (!UrlHelper::isAbsoluteUrl($path) && !is_file($path)) { |
@@ -406,7 +406,7 @@ discard block |
||
406 | 406 | $cache = Craft::$app->getCache(); |
407 | 407 | $file = $cache->getOrSet( |
408 | 408 | self::CACHE_KEY.$path, |
409 | - function () use ($path, $callback) { |
|
409 | + function() use ($path, $callback) { |
|
410 | 410 | $result = null; |
411 | 411 | $contents = @file_get_contents($path); |
412 | 412 | if ($contents) { |
@@ -436,7 +436,7 @@ discard block |
||
436 | 436 | protected static function combinePaths(string ...$paths): string |
437 | 437 | { |
438 | 438 | $last_key = count($paths) - 1; |
439 | - array_walk($paths, function (&$val, $key) use ($last_key) { |
|
439 | + array_walk($paths, function(&$val, $key) use ($last_key) { |
|
440 | 440 | switch ($key) { |
441 | 441 | case 0: |
442 | 442 | $val = rtrim($val, '/ '); |