public static function replace($patternString, $model) {
		//$patternString = '%%model_title%% %%sep%% %%appParam_contactEmail%% %%viewParam_titleSeparator%% %%appConfig_name%%';
		$replacedString = '';
		$patterns = self::findPatterns($patternString);

		$replacements = [];
		foreach ($patterns as $patternKey) {
			if (self::isCallbackPattern($patternKey)) {
				$replacement = self::callbackRetrievedStaticFunction($patternKey, $model);
			}

			if (self::isSeparatorPattern($patternKey)) {
				$replacement = self::retrieveSeparator();
			}

			// Replacement retrievals can return null if no replacement can be determined, root those outs.
			if (isset($replacement)) {
				$patternKey = self::addPatternDelimeter($patternKey);
				$replacements[$patternKey] = $replacement;
			}
			unset($replacement);
		}

		// Do the actual replacements.
		$replacedString = (is_array($replacements) && $replacements !== []) ?
			str_replace(array_keys($replacements), array_values($replacements), $patternString) :
			$patternString;

		$replacedString = self::sanitizeReplacedString($replacedString);

		return $replacedString;
	}
public static function replace($patternString, $model) {
		//$patternString = '%%model_title%% %%sep%% %%appParam_contactEmail%% %%viewParam_titleSeparator%% %%appConfig_name%%';
		$replacedString = '';
		$patterns = self::findPatterns($patternString);

		$replacements = [];
		foreach ($patterns as $patternKey) {
			if (self::isCallbackPattern($patternKey)) {
				$replacement = self::callbackRetrievedStaticFunction($patternKey, $model);
			}

			if (self::isSeparatorPattern($patternKey)) {
				$replacement = self::retrieveSeparator();
			}

			// Replacement retrievals can return null if no replacement can be determined, root those outs.
			if (isset($replacement)) {
				$patternKey = self::addPatternDelimeter($patternKey);
				$replacements[$patternKey] = $replacement;
			}
			unset($replacement);
		}

		// Do the actual replacements.
		$replacedString = (is_array($replacements) && $replacements !== []) ?
			str_replace(array_keys($replacements), array_values($replacements), $patternString) :
			$patternString;

		$replacedString = self::sanitizeReplacedString($replacedString);

		return $replacedString;
	}
public static function replace ( $ patternString , $ model ) { //$patternString = '%%model_title%% %%sep%% %%appParam_contactEmail%% %%viewParam_titleSeparator%% %%appConfig_name%%'; $ replacedString = '' ; $ patterns = self :: findPatterns ( $ patternString ) ; $ replacements = [ ] ; foreach ( $ patterns as $ patternKey ) { if ( self :: isCallbackPattern ( $ patternKey ) ) { $ replacement = self :: callbackRetrievedStaticFunction ( $ patternKey , $ model ) ; } if ( self :: isSeparatorPattern ( $ patternKey ) ) { $ replacement = self :: retrieveSeparator ( ) ; } // Replacement retrievals can return null if no replacement can be determined, root those outs. if ( isset ( $ replacement ) ) { $ patternKey = self :: addPatternDelimeter ( $ patternKey ) ; $ replacements [ $ patternKey ] = $ replacement ; } unset ( $ replacement ) ; } // Do the actual replacements. $ replacedString = ( is_array ( $ replacements ) && $ replacements !== [ ] ) ? str_replace ( array_keys ( $ replacements ) , array_values ( $ replacements ) , $ patternString ) : $ patternString ; $ replacedString = self :: sanitizeReplacedString ( $ replacedString ) ; return $ replacedString ; }
Function that replace patterns with theirs values.

@param $patternString
@param Model $model

@return mixed|string
Function that replace patterns with theirs values .