Below code, im using this yii2 cache alot in other code, same for:

				$jsBlock = preg_replace('/\/\*.*?\*\//s', '', $jsBlock);// Remove multiline comments.
				$jsBlock = preg_replace('/\/\/.*?(\r?\n|$)/', '', $jsBlock);// Remove single-line comments.
				$jsBlock = preg_replace('/\s+/', ' ', $jsBlock);// Collapse multiple whitespace to a single space (but not remove it completely).
				$jsBlock = trim($jsBlock);// Trim leading and trailing whitespace.
			
				// Optionally further minify by removing spaces around braces and colons.
				$jsBlock = preg_replace('/\s*:\s*/', ':', $jsBlock);// Remove spaces around colons.
				$jsBlock = preg_replace('/\s*{\s*/', '{', $jsBlock);// Remove spaces around opening braces.
				$jsBlock = preg_replace('/\s*}\s*/', '}', $jsBlock);// Remove spaces around closing braces.
				$jsBlock = preg_replace('/;\s*/', ';', $jsBlock);// Remove spaces after semicolons.
and

				$cssBlock = preg_replace('/\/\*.*?\*\//s', '', $cssBlock); // Remove multiline comments.
				$cssBlock = preg_replace('/\s+/', ' ', $cssBlock);// Collapse whitespace to a single space.
				$cssBlock = trim($cssBlock);// Remove leading and trailing whitespace.
				
				// Optional: Remove spaces around colons, braces, etc., to condense further.
				$cssBlock = preg_replace('/\s*:\s*/', ':', $cssBlock);// Remove spaces around colons.
				$cssBlock = preg_replace('/\s*{\s*/', '{', $cssBlock);// Remove spaces around opening braces.
				$cssBlock = preg_replace('/\s*}\s*/', '}', $cssBlock);// Remove spaces around closing braces.
				$cssBlock = preg_replace('/;\s*/', ';', $cssBlock);// Remove spaces after semicolons.

```
	protected function registerJs(int $id): void
	{
		/**
		* Yii Cache
		* @url https://www.yiiframework.com/doc/guide/2.0/en/caching-data
		*/
		$cache = \Yii::$app->cache;
		
		/**
		* Clearing a Specific Cache Key
		*
		* Clearing All Cache:
		*	$cache->flush();
		*
		* Run this command from the terminal as follows:
		*	$ ./yii cache/clear
		*
		$cache->flush();//*/
		$jsKey = $this->_cacheKeyPrefix . $id . '_js_block_';
		$jsBlock = false;
		
		if ($this->_cacheEnable)
		{
			$jsBlock = $cache->get($jsKey);
		}
		else
		{
			$cache->delete($jsKey);
		}
		
		if ($jsBlock === false)
		{
			// Debug Mode - If cache enabled 
			if ($this->_cacheEnable && $this->_debugMode)
			{
				// LogHelper::debug(); checks for YII_DEBUG
				LogHelper::debug(sprintf('Cache MISSING for %d key', $jsKey), [
					'data key' => $jsKey,
					'class' => __CLASS__,
					'method' => __METHOD__,
					'function' => __FUNCTION__,
					'file' => __FILE__,
					'line' => __LINE__
				]);
			}
			
			$jsBlock = <<<JS
				(function(\$)
				{
					/* DOM ready shorthand */
					\$(function()
					{
						/* Define the context as the input group container. */
						var \$container = \$('.input-group');
						
						/* If container doesn't exist, stop execution. */
						if (!\$container.length)
						{
							return;
						}
						
						/* Handle click events for clipboard buttons within the container. */
						\$container.find('.clipboard-btn[data-target-id=\"{$id}\"]').each(function()
						{
							var input = document.getElementById('{$id}');
							if (!input)
							{
								return;
							}
							
							var action = '{$this->action}';
							var promise;
							
							if (navigator.clipboard)
							{
								if (action === 'cut')
								{
									/* Use native select and execCommand('cut') */
									input.select();
									document.execCommand('cut');
									
									/* jQuery deferred resolved immediately to keep API consistent */
									promise = \$.Deferred().resolve().promise();
								}
								else
								{
									promise = navigator.clipboard.writeText(input.value);
								}
								
								promise.then(function()
								{
									highlightInput(\$(input));
									
									/* Handle success notification if needed, e.g. alert */
									//alert('Text ' + action + 'ed to clipboard!');
								}
								).catch(function(err)
								{
									/* Handle error notification if needed */
									//alert('Failed to ' + action + ' text: ' + err);
								});
							}
							else
							{
								/* Fallback for older browsers */
								input.select();
								document.execCommand(action);
								highlightInput(\$(input));
								
								//alert('Text ' + action + 'ed to clipboard (fallback).');
							}
						});
						
						/* Function to apply and then remove highlight class for the input element */
						function highlightInput(\$input)
						{
							\$input.addClass('input-highlight');
							
							setTimeout(function()
							{
								\$input.removeClass('input-highlight');
							},
							1500);/* Highlight duration in milliseconds. */
						}
					});
				})(jQuery);
			JS;
			
			if ($this->_compressJsCss)
			{
				$jsBlock = preg_replace('/\/\*.*?\*\//s', '', $jsBlock);// Remove multiline comments.
				$jsBlock = preg_replace('/\/\/.*?(\r?\n|$)/', '', $jsBlock);// Remove single-line comments.
				$jsBlock = preg_replace('/\s+/', ' ', $jsBlock);// Collapse multiple whitespace to a single space (but not remove it completely).
				$jsBlock = trim($jsBlock);// Trim leading and trailing whitespace.
			
				// Optionally further minify by removing spaces around braces and colons.
				$jsBlock = preg_replace('/\s*:\s*/', ':', $jsBlock);// Remove spaces around colons.
				$jsBlock = preg_replace('/\s*{\s*/', '{', $jsBlock);// Remove spaces around opening braces.
				$jsBlock = preg_replace('/\s*}\s*/', '}', $jsBlock);// Remove spaces around closing braces.
				$jsBlock = preg_replace('/;\s*/', ';', $jsBlock);// Remove spaces after semicolons.
			}
			
			if ($this->_cacheEnable)
			{
				// Store the processed JavaScript into the cache.
				$cache->set(
					$jsKey,
					$jsBlock,
					($this->_cacheJsCssTime > 0) ? $this->_cacheJsCssTime : self::DEFAULT_DURATION_SECONDS
				);
				
				if ($this->_debugMode)
				{
					$readableTime = TimeHelper::secondsToReadableTime($this->_cacheJsCssTime);
					LogHelper::debug(sprintf('Cached %d SAVED for %d seconds', $jsKey, $readableTime), [
						'data key' => $jsKey,
						'class' => __CLASS__,
						'method' => __METHOD__,
						'function' => __FUNCTION__,
						'file' => __FILE__,
						'line' => __LINE__
					]);
				}
			}
		}
		// Get data from cache - Debug Mode - log
		elseif ($this->_cacheEnable && $this->_debugMode)
		{
			// LogHelper::debug(); checks for YII_DEBUG
			LogHelper::debug(sprintf('Cache HIT for %d key', $jsKey), [
				'data key' => $jsKey,
				'class' => __CLASS__,
				'method' => __METHOD__,
				'function' => __FUNCTION__,
				'file' => __FILE__,
				'line' => __LINE__
			]);
		}
		
		// Register the JavaScript.
		$this->getView()->registerJs($jsBlock, View::POS_END);
	}
	
	protected function registerCss(int $id): void
	{
		/**
		* Yii Cache
		* @url https://www.yiiframework.com/doc/guide/2.0/en/caching-data
		*/
		$cache = \Yii::$app->cache;
		
		/**
		* Clearing a Specific Cache Key
		*
		* Clearing All Cache:
		*	$cache->flush();
		*
		* Run this command from the terminal as follows:
		*	$ ./yii cache/clear
		*
		$cache->flush();//*/
		$cssKey = $this->_cacheKeyPrefix . $id . '_css_block_';
		$cssBlock = false;
		
		if ($this->_cacheEnable)
		{
			$cssBlock = $cache->get($cssKey);
		}
		else
		{
			$cssBlock = $cache->get($cssKey);
		}
		
		if ($cssBlock === false)
		{
			$cssBlock = <<<CSS
				.input-highlight
				{
					/*border-color: #28a745;// Green border color for copy success */
					boader-color: var(--primary-color);
					/*box-shadow: 0 0 5px #28a745;// Optional shadow effect for emphasis */
					box-shadow: 0 0 5px var(--primary-color);
					transition: border-color 0.5s ease, box-shadow 0.5s ease;/* Smooth transition */
				}
			CSS;
			
			if ($this->_compressJsCss)
			{
				$cssBlock = preg_replace('/\/\*.*?\*\//s', '', $cssBlock); // Remove multiline comments.
				$cssBlock = preg_replace('/\s+/', ' ', $cssBlock);// Collapse whitespace to a single space.
				$cssBlock = trim($cssBlock);// Remove leading and trailing whitespace.
				
				// Optional: Remove spaces around colons, braces, etc., to condense further.
				$cssBlock = preg_replace('/\s*:\s*/', ':', $cssBlock);// Remove spaces around colons.
				$cssBlock = preg_replace('/\s*{\s*/', '{', $cssBlock);// Remove spaces around opening braces.
				$cssBlock = preg_replace('/\s*}\s*/', '}', $cssBlock);// Remove spaces around closing braces.
				$cssBlock = preg_replace('/;\s*/', ';', $cssBlock);// Remove spaces after semicolons.//*/
			}
			
			if ($this->_cacheEnable)
			{
				// Store the processed JavaScript into the cache.
				$cache->set(
					$cssKey,
					$cssBlock,
					($this->_cacheJsCssTime > 0) ? $this->_cacheJsCssTime : self::DEFAULT_DURATION_SECONDS
				);
				
				if ($this->_debugMode)
				{
					$readableTime = TimeHelper::secondsToReadableTime($this->_cacheJsCssTime);
					LogHelper::debug(sprintf('Cached %d SAVED for %d seconds', $cssKey, $readableTime), [
						'data key' => $cssKey,
						'class' => __CLASS__,
						'method' => __METHOD__,
						'function' => __FUNCTION__,
						'file' => __FILE__,
						'line' => __LINE__
					]);
				}
			}
		}
		// Get data from cache - Debug Mode - log
		elseif ($this->_cacheEnable && $this->_debugMode)
		{
			// LogHelper::debug(); checks for YII_DEBUG
			LogHelper::debug(sprintf('Cache HIT for %d key', $cssKey), [
				'data key' => $cssKey,
				'class' => __CLASS__,
				'method' => __METHOD__,
				'function' => __FUNCTION__,
				'file' => __FILE__,
				'line' => __LINE__
			]);
		}
		
		// Register the CSS.
		$this->getView()->registerCss($cssBlock);
	}
```

could you help create a helper file that i could use for all my widget code that depends on cache and sometimes compression of css and js?