public function optimize(array $expression, Call $call, CompilationContext $context)
{
if (!isset($expression['parameters'])) {
return false;
}
if (count($expression['parameters']) != 1) {
throw new CompilerException("'unique_path_key' only accepts one parameter", $expression);
}
/**
* Process the expected symbol to be returned
*/
$call->processExpectedReturn($context);
$symbolVariable = $call->getSymbolVariable(true, $context);
if ($symbolVariable->isNotVariableAndString()) {
throw new CompilerException("Returned values by functions can only be assigned to variant variables", $expression);
}
if ($call->mustInitSymbolVariable()) {
$symbolVariable->initVariant($context);
}
$context->headersManager->add('kernel/file');
$resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression);
$symbol = $context->backend->getVariableCode($symbolVariable);
$context->codePrinter->output('zephir_unique_path_key(' . $symbol . ', ' . $resolvedParams[0] . ' TSRMLS_CC);');
return new CompiledExpression('variable', $symbolVariable->getRealName(), $expression);
}