本文整理汇总了PHP中Zephir\Call::getResolvedParams方法的典型用法代码示例。如果您正苦于以下问题:PHP Call::getResolvedParams方法的具体用法?PHP Call::getResolvedParams怎么用?PHP Call::getResolvedParams使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zephir\Call
的用法示例。
在下文中一共展示了Call::getResolvedParams方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: optimize
/**
* @param array $expression
* @param Call $call
* @param CompilationContext $context
* @return bool|CompiledExpression
* @throws CompilerException
*/
public function optimize(array $expression, Call $call, CompilationContext $context)
{
if (!isset($expression['parameters'])) {
return false;
}
if (count($expression['parameters']) != 1) {
throw new CompilerException("phalcon_get_uri only accepts three parameter", $expression);
}
/**
* Process the expected symbol to be returned
*/
$call->processExpectedReturn($context);
$symbolVariable = $call->getSymbolVariable();
if ($symbolVariable->getType() != 'variable') {
throw new CompilerException("Returned values by functions can only be assigned to variant variables", $expression);
}
if ($call->mustInitSymbolVariable()) {
$symbolVariable->initVariant($context);
}
$context->headersManager->add('phalcon/mvc/url/utils', HeadersManager::POSITION_LAST);
$resolvedParams = $call->getResolvedParams($expression['parameters'], $context, $expression);
$symbol = $context->backend->getVariableCode($symbolVariable);
$context->codePrinter->output('phalcon_get_uri(' . $symbol . ', ' . $resolvedParams[0] . ');');
return new CompiledExpression('variable', $symbolVariable->getRealName(), $expression);
}
示例2: optimize
/**
* @param array $expression
* @param Call $call
* @param CompilationContext $context
* @return bool|CompiledExpression
* @throws CompilerException
*/
public function optimize(array $expression, Call $call, CompilationContext $context)
{
if (!isset($expression['parameters'])) {
return false;
}
if (count($expression['parameters']) != 3) {
throw new CompilerException("phannot_parse_annotations only accepts three parameter", $expression);
}
/**
* Process the expected symbol to be returned
*/
$call->processExpectedReturn($context);
$symbolVariable = $call->getSymbolVariable();
if ($symbolVariable->getType() != 'variable') {
throw new CompilerException("Returned values by functions can only be assigned to variant variables", $expression);
}
if ($call->mustInitSymbolVariable()) {
$symbolVariable->initVariant($context);
}
$context->headersManager->add('phalcon/annotations/scanner', HeadersManager::POSITION_LAST);
$context->headersManager->add('phalcon/annotations/annot', HeadersManager::POSITION_LAST);
$symbolVariable->setDynamicTypes('array');
$resolvedParams = $call->getResolvedParams($expression['parameters'], $context, $expression);
$call->addCallStatusFlag($context);
$symbol = $context->backend->getVariableCode($symbolVariable);
$context->codePrinter->output('ZEPHIR_LAST_CALL_STATUS = phannot_parse_annotations(' . $symbol . ', ' . $resolvedParams[0] . ', ' . $resolvedParams[1] . ', ' . $resolvedParams[2] . ' TSRMLS_CC);');
$call->checkTempParameters($context);
$call->addCallStatusOrJump($context);
return new CompiledExpression('variable', $symbolVariable->getRealName(), $expression);
}
示例3: optimize
/**
* @param array $expression
* @param Call $call
* @param CompilationContext $context
* @return bool|CompiledExpression|mixed
* @throws CompilerException
*/
public function optimize(array $expression, Call $call, CompilationContext $context)
{
if (!isset($expression['parameters'])) {
return false;
}
if (count($expression['parameters']) != 1) {
throw new CompilerException("phalcon_jsmin only accepts one parameter", $expression);
}
/**
* Process the expected symbol to be returned
*/
$call->processExpectedReturn($context);
$symbolVariable = $call->getSymbolVariable();
if ($symbolVariable->getType() != 'variable') {
throw new CompilerException("Returned values by functions can only be assigned to variant variables", $expression);
}
if ($call->mustInitSymbolVariable()) {
$symbolVariable->initVariant($context);
}
$context->headersManager->add('phalcon/assets/filters/jsminifier');
$symbolVariable->setDynamicTypes('string');
$resolvedParams = $call->getResolvedParams($expression['parameters'], $context, $expression);
$context->codePrinter->output('phalcon_jsmin(' . $symbolVariable->getName() . ', ' . $resolvedParams[0] . ' TSRMLS_CC);');
return new CompiledExpression('variable', $symbolVariable->getRealName(), $expression);
}
示例4: optimize
/**
* @param array $expression
* @param Call $call
* @param CompilationContext $context
* @return bool|CompiledExpression|mixed
*/
public function optimize(array $expression, Call $call, CompilationContext $context)
{
if (!isset($expression['parameters'])) {
return false;
}
/**
* Process the expected symbol to be returned
*/
$call->processExpectedReturn($context);
$symbolVariable = $call->getSymbolVariable();
if ($symbolVariable) {
if ($symbolVariable->getType() != 'variable') {
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/variables');
$resolvedParams = $call->getResolvedParams($expression['parameters'], $context, $expression);
if ($symbolVariable) {
$context->codePrinter->output('zephir_var_export_ex(' . $symbolVariable->getName() . ', &(' . $resolvedParams[0] . ') TSRMLS_CC);');
return new CompiledExpression('variable', $symbolVariable->getRealName(), $expression);
}
$context->codePrinter->output('zephir_var_export(&' . $resolvedParams[0] . ' TSRMLS_CC);');
return new CompiledExpression('null', 'null', $expression);
}
示例5: optimize
/**
* @param array $expression
* @param Call $call
* @param CompilationContext $context
* @return bool|CompiledExpression|mixed
* @throws CompilerException
*/
public function optimize(array $expression, Call $call, CompilationContext $context)
{
if (!isset($expression['parameters'])) {
return false;
}
if (count($expression['parameters']) > 1) {
return false;
}
/**
* Resolve parameters as vars
*/
$call->getResolvedParams($expression['parameters'], $context, $expression);
/**
* Get CompiledExpression(s) for resolved var(s)
*/
$resolvedParams = $call->getResolvedParamsAsExpr($expression['parameters'], $context, $expression);
$compiledExpression = $resolvedParams[0];
switch ($compiledExpression->getType()) {
case 'int':
case 'float':
case 'long':
case 'ulong':
case 'double':
$context->headersManager->add('math');
return $this->passNativeFCall($compiledExpression, $expression);
break;
case 'variable':
$variable = $context->symbolTable->getVariable($compiledExpression->getCode());
switch ($variable->getType()) {
case 'int':
case 'float':
case 'long':
case 'ulong':
case 'double':
$context->headersManager->add('math');
return $this->passNativeFCall($compiledExpression, $expression);
break;
case 'variable':
$context->headersManager->add('kernel/math');
return new CompiledExpression('double', 'zephir_' . $this->getFunctionName() . '(' . $context->backend->getVariableCode($variable) . ' TSRMLS_CC)', $expression);
break;
}
break;
}
return false;
}