src/View/Twig/TwigTranspiler.php
/**
	 * Processes an arguments string and converts it to Twig format, allowing a Blade-like syntax.
	 *
	 * @param string $arguments
	 * @return string
	 */
Processes an arguments string and converts it to Twig format, allowing a Blade-like syntax.
@param string $arguments
@return string
Processes an arguments string and converts it to Twig format allowing a Blade - like syntax . @param string $arguments @return string
protected function buildArgumentString($arguments) {
		$result = '';
		$i = 0;
		$inString = false;
		$disableString = false;
		$stringCharacter = '';
		$length = strlen($arguments);
		while ($i < $length) {
			$char = $arguments[$i];
			$insertCharacter = $char;
			$previous = ($i > 0) ? $arguments[$i - 1] : null;
			if ($char === '\\') {
				$disableString = !$disableString;
			}
			else if ($char !== '"' && $char !== "'") {
				$disableString = false;
			}
			if (!$disableString) {
				if (!$inString && ($char === '"' || $char === "'")) {
					$inString = true;
					$stringCharacter = $char;
				}
				else if ($inString && $char === $stringCharacter) {
					$inString = false;
					$stringCharacter = false;
				}
			}
			if (!$inString && $char === '+') {
				$insertCharacter = '~';
			}
			if (!$inString && $char === '$') {
				if ($previous === null || !$disableString) {
					$insertCharacter = '';
				}
			}
			if ($insertCharacter !== '') {
				$result .= $insertCharacter;
			}
			$i++;
		}
		return $result;
	}
protected function buildArgumentString ( $ arguments ) { $ result = '' ; $ i = 0 ; $ inString = false ; $ disableString = false ; $ stringCharacter = '' ; $ length = strlen ( $ arguments ) ; while ( $ i < $ length ) { $ char = $ arguments [ $ i ] ; $ insertCharacter = $ char ; $ previous = ( $ i > 0 ) ? $ arguments [ $ i - 1 ] : null ; if ( $ char === '\\' ) { $ disableString = ! $ disableString ; } else if ( $ char !== '"' && $ char !== " ' " ) { $ disableString = false ; } if ( ! $ disableString ) { if ( ! $ inString && ( $ char === '"' || $ char === " ' " ) ) { $ inString = true ; $ stringCharacter = $ char ; } else if ( $ inString && $ char === $ stringCharacter ) { $ inString = false ; $ stringCharacter = false ; } } if ( ! $ inString && $ char === '+' ) { $ insertCharacter = '~' ; } if ( ! $ inString && $ char === '$' ) { if ( $ previous === null || ! $ disableString ) { $ insertCharacter = '' ; } } if ( $ insertCharacter !== '' ) { $ result .= $ insertCharacter ; } $ i ++ ; } return $ result ; }
Processes an arguments string and converts it to Twig format, allowing a Blade-like syntax.
Processes an arguments string and converts it to Twig format allowing a Blade - like syntax .