' . preg_quote(Delimiters::STATEMENT_OPEN) . '\s*(?:if|for|foreach|with|snippet)\s.*?' . preg_quote(Delimiters::STATEMENT_CLOSE) . ')|' . '(?P' . preg_quote(Delimiters::STATEMENT_OPEN) . '\s*else\s*' . preg_quote(Delimiters::STATEMENT_CLOSE) . ')|' . '(?P' . preg_quote(Delimiters::STATEMENT_OPEN) . '\s*end\s*' . preg_quote(Delimiters::STATEMENT_CLOSE) . ')' . ')/is'; return preg_replace_callback($regex, function ($match) use (&$depth) { // Convert $match to the actually needed string. $return = array_unique($match); $return = array_filter($return); $return = implode($return); // Decrease depth in case the match is else or end. if (!empty($match['end']) || !empty($match['else'])) { $depth--; } // Append a marker to the opening delimiter in case depth === 0. if ($depth === 0) { $return = str_replace(Delimiters::STATEMENT_OPEN, Delimiters::STATEMENT_OPEN . Delimiters::OUTER_STATEMENT_MARKER, $return); } // Increase depth after (!) return was possible modified (in case depth === 0) in case the match is begin or else. if (!empty($match['begin']) || !empty($match['else'])) { $depth++; } return $return; }, $str); } /** * Strip whitespace before or after delimiters when using `<@~` or `~@>`. * * @param string $str * @return string The processed string */ public static function stripWhitespace(string $str): string { $str = preg_replace('/\s*(' . preg_quote(Delimiters::STATEMENT_OPEN) . ')~/is', '$1', $str); $str = preg_replace('/~(' . preg_quote(Delimiters::STATEMENT_CLOSE) . ')\s*/is', '$1', $str); return $str; } } __halt_compiler();----SIGNATURE:----UPdLIFsFvi0Wb2MiUq3KV2jEuKAvwfKPyrAl8bboDNf7SVCQOf6zhRyIOl4eAYJ0dKuwRCCy+FZPXTI8tuObbnqu8TVnv7jhnRZ6/R81s47HMAHy3VdVZGMhOpTkdTxGk9K2AJ9FWbkQ8F8GH+DW0fB+g4QCGr8nNePYG3gY9p7JXZ3bk4ieAfzucTtsfuIruidyBZbfT+bgYTmEKHMOTKML4uxZYIdkUbthEblqfKiTOkI7t7uhQUyNCmRNzGTvme9NDn9AM/b221iC/kin1MG8jPJZv1JcbPPpJE9e+tWw2EirlbaDLNMNpRMBzCu3ZFXyqbTKK3Ky1ed+3NBqDiBdFIS6LK4b+99N+IzF80lIaAVQf4d3/y1+xie8+jVHCabxpG9lsRvzOS1u/LCxBMTi1NKKAclQD1tp4xibgnilncEynCaweaAVZaKxer+/Pq52C3pcl5u/8mgnsB+QJ3UkOYNjczW4I86TXdxT+wWh5JzeKc5e3bM2Mk0ieWPSxCo0E1ANHJBfzL8Y+5Sspnn77gV8SYhcHi5a0ue1/VR5dk3BMZ30/J6syLA7KYSwbv2RpQ8LvdDqgCN2f5m8JbzOJKwMYjFiF1V3RpXvMdkVCZrYI4Qryf04zmQwwi+Xp7iRguuaz78sZAzPWpk7TqLeX2muWvN/L/cXnSQqYuI=----ATTACHMENT:----MzE2MTgyMTIyNDMyMzgxMCA1OTIxMTQ3OTAxODM1OTMwIDU1Njg4ODU5MTI2NTc3Mjc=