@@ -119,22 +119,22 @@ |
||
119 | 119 | ); |
120 | 120 | } |
121 | 121 | |
122 | - /** |
|
123 | - * Return the HASH value from a module |
|
124 | - * |
|
125 | - * @param string $moduleName |
|
126 | - * @param string $type |
|
127 | - * @param null $config |
|
128 | - * |
|
129 | - * @return null|Markup |
|
130 | - * @throws NotFoundHttpException |
|
131 | - */ |
|
132 | - public function getModuleHash(string $moduleName, string $type = 'modern', $config = null) |
|
133 | - { |
|
134 | - return Template::raw( |
|
135 | - Twigpack::$plugin->manifest->getModuleHash($moduleName, $type, $config) |
|
136 | - ); |
|
137 | - } |
|
122 | + /** |
|
123 | + * Return the HASH value from a module |
|
124 | + * |
|
125 | + * @param string $moduleName |
|
126 | + * @param string $type |
|
127 | + * @param null $config |
|
128 | + * |
|
129 | + * @return null|Markup |
|
130 | + * @throws NotFoundHttpException |
|
131 | + */ |
|
132 | + public function getModuleHash(string $moduleName, string $type = 'modern', $config = null) |
|
133 | + { |
|
134 | + return Template::raw( |
|
135 | + Twigpack::$plugin->manifest->getModuleHash($moduleName, $type, $config) |
|
136 | + ); |
|
137 | + } |
|
138 | 138 | |
139 | 139 | /** |
140 | 140 | * Include the Safari 10.1 nomodule fix JavaScript |
@@ -131,25 +131,25 @@ |
||
131 | 131 | return ManifestHelper::getModule($config, $moduleName, $type); |
132 | 132 | } |
133 | 133 | |
134 | - /** |
|
135 | - * Return the HASH value from a module |
|
136 | - * |
|
137 | - * @param string $moduleName |
|
138 | - * @param string $type |
|
139 | - * @param null $config |
|
140 | - * |
|
141 | - * @return null|string |
|
142 | - * @throws NotFoundHttpException |
|
143 | - */ |
|
144 | - public function getModuleHash(string $moduleName, string $type = 'modern', $config = null) |
|
145 | - { |
|
146 | - $settings = Twigpack::$plugin->getSettings(); |
|
147 | - $config = $config ?? $settings->getAttributes(); |
|
148 | - |
|
149 | - return ManifestHelper::getModuleHash($config, $moduleName, $type); |
|
150 | - } |
|
151 | - |
|
152 | - /** |
|
134 | + /** |
|
135 | + * Return the HASH value from a module |
|
136 | + * |
|
137 | + * @param string $moduleName |
|
138 | + * @param string $type |
|
139 | + * @param null $config |
|
140 | + * |
|
141 | + * @return null|string |
|
142 | + * @throws NotFoundHttpException |
|
143 | + */ |
|
144 | + public function getModuleHash(string $moduleName, string $type = 'modern', $config = null) |
|
145 | + { |
|
146 | + $settings = Twigpack::$plugin->getSettings(); |
|
147 | + $config = $config ?? $settings->getAttributes(); |
|
148 | + |
|
149 | + return ManifestHelper::getModuleHash($config, $moduleName, $type); |
|
150 | + } |
|
151 | + |
|
152 | + /** |
|
153 | 153 | * Returns the contents of a file from a URI path |
154 | 154 | * |
155 | 155 | * @param string $path |
@@ -243,39 +243,39 @@ |
||
243 | 243 | return $module; |
244 | 244 | } |
245 | 245 | |
246 | - /** |
|
247 | - * Return the HASH value from to module |
|
248 | - * |
|
249 | - * @param array $config |
|
250 | - * @param string $moduleName |
|
251 | - * @param string $type |
|
252 | - * @param bool $soft |
|
253 | - * |
|
254 | - * @return null|string |
|
255 | - * @throws NotFoundHttpException |
|
256 | - */ |
|
257 | - public static function getModuleHash(array $config, string $moduleName, string $type = 'modern', bool $soft = false) |
|
258 | - { |
|
259 | - |
|
260 | - try { |
|
261 | - // Get the module entry |
|
262 | - $module = self::getModuleEntry($config, $moduleName, $type, $soft); |
|
263 | - if ($module !== null) { |
|
264 | - $prefix = self::$isHot |
|
265 | - ? $config['devServer']['publicPath'] |
|
266 | - : $config['server']['publicPath']; |
|
267 | - // Extract only the Hash Value |
|
268 | - $modulePath = pathinfo($module); |
|
269 | - $moduleFilename = $modulePath['filename']; |
|
270 | - $moduleHash = substr($moduleFilename, strpos($moduleFilename, ".") + 1); |
|
271 | - } |
|
272 | - } catch (Exception $e) { |
|
273 | - // return emtpt string if no module is found |
|
274 | - return ''; |
|
275 | - } |
|
276 | - |
|
277 | - return $moduleHash; |
|
278 | - } |
|
246 | + /** |
|
247 | + * Return the HASH value from to module |
|
248 | + * |
|
249 | + * @param array $config |
|
250 | + * @param string $moduleName |
|
251 | + * @param string $type |
|
252 | + * @param bool $soft |
|
253 | + * |
|
254 | + * @return null|string |
|
255 | + * @throws NotFoundHttpException |
|
256 | + */ |
|
257 | + public static function getModuleHash(array $config, string $moduleName, string $type = 'modern', bool $soft = false) |
|
258 | + { |
|
259 | + |
|
260 | + try { |
|
261 | + // Get the module entry |
|
262 | + $module = self::getModuleEntry($config, $moduleName, $type, $soft); |
|
263 | + if ($module !== null) { |
|
264 | + $prefix = self::$isHot |
|
265 | + ? $config['devServer']['publicPath'] |
|
266 | + : $config['server']['publicPath']; |
|
267 | + // Extract only the Hash Value |
|
268 | + $modulePath = pathinfo($module); |
|
269 | + $moduleFilename = $modulePath['filename']; |
|
270 | + $moduleHash = substr($moduleFilename, strpos($moduleFilename, ".") + 1); |
|
271 | + } |
|
272 | + } catch (Exception $e) { |
|
273 | + // return emtpt string if no module is found |
|
274 | + return ''; |
|
275 | + } |
|
276 | + |
|
277 | + return $moduleHash; |
|
278 | + } |
|
279 | 279 | |
280 | 280 | /** |
281 | 281 | * Return a module's raw entry from the manifest |