当前位置: 首页>>代码示例>>PHP>>正文


PHP Zephir\Call类代码示例

本文整理汇总了PHP中Zephir\Call的典型用法代码示例。如果您正苦于以下问题:PHP Call类的具体用法?PHP Call怎么用?PHP Call使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Call类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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;
     }
     $context->headersManager->add('kernel/variables');
     $resolvedParams = $call->getResolvedParamsAsExpr($expression['parameters'], $context, $expression);
     foreach ($resolvedParams as $resolvedParam) {
         $variable = $context->symbolTable->getVariable($resolvedParam->getCode());
         if (!$variable || !$variable->isVariable()) {
             /**
              * Complex expressions require a temporary variable
              */
             switch ($resolvedParam->getType()) {
                 case 'array':
                     $type = 'array';
                     break;
                 default:
                     $type = 'variable';
                     break;
             }
             $variable = $context->symbolTable->addTemp($type, $context);
             $variable->initVariant($context);
             $statement = new LetStatement(array('type' => 'let', 'assignments' => array(array('assign-type' => $type, 'variable' => $variable->getName(), 'operator' => 'assign', 'expr' => array('type' => $resolvedParam->getType(), 'value' => $resolvedParam->getCode(), 'file' => $expression['file'], 'line' => $expression['line'], 'char' => $expression['char']), 'file' => $expression['file'], 'line' => $expression['line'], 'char' => $expression['char']))));
             $statement->compile($context);
         } else {
             /**
              * This mark the variable as used
              */
             $variable = $context->symbolTable->getVariableForRead($resolvedParam->getCode(), $context, $expression);
         }
         $context->codePrinter->output('zephir_var_dump(&' . $variable->getName() . ' TSRMLS_CC);');
     }
     return new CompiledExpression('null', 'null', $expression);
 }
开发者ID:edin,项目名称:zephir,代码行数:41,代码来源:VarDumpOptimizer.php

示例2: 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("'uncamelize' only accepts one parameter");
     }
     /**
      * 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);
     }
     $context->headersManager->add('kernel/string');
     $symbolVariable->setDynamicTypes('string');
     $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression);
     if ($call->mustInitSymbolVariable()) {
         $symbolVariable->initVariant($context);
     }
     $context->codePrinter->output('zephir_uncamelize(' . $symbolVariable->getName() . ', ' . $resolvedParams[0] . ');');
     return new CompiledExpression('variable', $symbolVariable->getRealName(), $expression);
 }
开发者ID:edin,项目名称:zephir,代码行数:32,代码来源:UncamelizeOptimizer.php

示例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']) != 3) {
         if (count($expression['parameters']) == 4) {
             return false;
         }
         throw new CompilerException("'str_replace' only accepts three 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);
     }
     $context->headersManager->add('kernel/string');
     $symbolVariable->setDynamicTypes('string');
     $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression);
     if ($call->mustInitSymbolVariable()) {
         if ($symbolVariable->getName() == 'return_value') {
             $symbolVariable = $context->symbolTable->getTempVariableForWrite('variable', $context);
         } else {
             $symbolVariable->initVariant($context);
         }
     }
     $symbol = $context->backend->getVariableCodePointer($symbolVariable);
     $context->codePrinter->output('zephir_fast_str_replace(' . $symbol . ', ' . $resolvedParams[0] . ', ' . $resolvedParams[1] . ', ' . $resolvedParams[2] . ' TSRMLS_CC);');
     return new CompiledExpression('variable', $symbolVariable->getRealName(), $expression);
 }
开发者ID:zhao5908,项目名称:zephir,代码行数:40,代码来源:StrReplaceOptimizer.php

示例4: 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'])) {
         $numberParameters = count($expression['parameters']);
         if ($numberParameters != 0) {
             return false;
         }
     }
     /**
      * 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/object');
     $symbolVariable->setDynamicTypes('string');
     $symbol = $context->backend->getVariableCode($symbolVariable);
     $context->codePrinter->output('zephir_get_called_class(' . $symbol . ' TSRMLS_CC);');
     return new CompiledExpression('variable', $symbolVariable->getRealName(), $expression);
 }
开发者ID:zhao5908,项目名称:zephir,代码行数:32,代码来源:GetCalledClassOptimizer.php

示例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'])) {
         throw new CompilerException("'globals_set' requires two parameters", $expression);
     }
     if (count($expression['parameters']) != 2) {
         throw new CompilerException("'globals_set' only accepts two parameters", $expression);
     }
     if ($expression['parameters'][0]['parameter']['type'] != 'string') {
         throw new CompilerException("A string parameter is required for 'globals_set'", $expression);
     }
     $globalName = $expression['parameters'][0]['parameter']['value'];
     if (!$context->compiler->isExtensionGlobal($globalName)) {
         throw new CompilerException("Global '" . $globalName . "' cannot be written because it wasn't defined", $expression);
     }
     unset($expression['parameters'][0]);
     $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression);
     //$globalDefinition = $context->compiler->getExtensionGlobal($globalName);
     //if (strpos($globalName, '.') !== false) {
     //    $parts = explode('.', $globalName);
     //    return new CompiledExpression($globalDefinition['type'], 'ZEPHIR_GLOBAL(' . $parts[0] . ').' . $parts[1], $expression);
     //}
     //return new CompiledExpression($globalDefinition['type'], 'ZEPHIR_GLOBAL(' . $globalName . ')', $expression);
     return new CompiledExpression('null', null, $expression);
 }
开发者ID:NumbDai,项目名称:zephir,代码行数:32,代码来源:GlobalsSetOptimizer.php

示例6: optimize

 /**
  * @param array $expression
  * @param Call $call
  * @param CompilationContext $context
  * @return CompiledExpression|mixed
  * @throws CompilerException
  */
 public function optimize(array $expression, Call $call, CompilationContext $context)
 {
     if (isset($expression['parameters'])) {
         if (count($expression['parameters']) != 0) {
             throw new CompilerException("This function doesn't require parameters", $expression);
         }
     }
     /**
      * Process the expected symbol to be returned
      */
     $call->processExpectedReturn($context);
     $symbolVariable = $call->getSymbolVariable(true, $context);
     if ($symbolVariable) {
         if (!$symbolVariable->isVariable()) {
             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/memory');
     $context->codePrinter->output('zephir_create_symbol_table(TSRMLS_C);');
     $context->codePrinter->output('');
     return new CompiledExpression('null', null, $expression);
 }
开发者ID:zhao5908,项目名称:zephir,代码行数:32,代码来源:CreateSymbolTableOptimizer.php

示例7: 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);
 }
开发者ID:lisong,项目名称:cphalcon,代码行数:32,代码来源:PhalconJsminOptimizer.php

示例8: optimize

 /**
  *
  * @param array $expression
  * @param Call $call
  * @param CompilationContext $context
  */
 public function optimize(array $expression, Call $call, CompilationContext $context)
 {
     if (!isset($expression['parameters'])) {
         return false;
     }
     if (count($expression['parameters']) != 2) {
         return false;
     }
     /**
      * 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('kernel/array');
     $symbolVariable->setDynamicTypes('array');
     $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression);
     //$context->codePrinter->output('zephir_fast_array_merge(' . $symbolVariable->getName() . ', &(' . $resolvedParams[0] . '), &(' . $resolvedParams[1] . ') TSRMLS_CC);');
     return new CompiledExpression('variable', $symbolVariable->getRealName(), $expression);
 }
开发者ID:starsw001,项目名称:cphalcon,代码行数:31,代码来源:PhalconPrepareVirtualPathOptimizer.php

示例9: 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->isVariable()) {
             throw new CompilerException("Returned values by functions can only be assigned to variant variables", $expression);
         }
     } else {
         $symbolVariable = $context->symbolTable->addTemp('variable', $context);
         $symbolVariable->initVariant($context);
     }
     $context->headersManager->add('kernel/string');
     $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression);
     /**
      * Process encode options
      */
     if (count($resolvedParams) >= 2) {
         $context->headersManager->add('kernel/operators');
         $options = 'zephir_get_intval(' . $resolvedParams[1] . ') ';
     } else {
         $options = '0 ';
     }
     if ($call->mustInitSymbolVariable()) {
         $symbolVariable->initVariant($context);
     }
     $context->codePrinter->output('zephir_json_decode(' . $symbolVariable->getName() . ', &(' . $symbolVariable->getName() . '), ' . $resolvedParams[0] . ', ' . $options . ' TSRMLS_CC);');
     return new CompiledExpression('variable', $symbolVariable->getRealName(), $expression);
 }
开发者ID:edin,项目名称:zephir,代码行数:41,代码来源:JsonDecodeOptimizer.php

示例10: 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;
     }
     $numberParameters = count($expression['parameters']);
     if ($numberParameters != 1 && $numberParameters != 2) {
         throw new CompilerException("'get_class_ns' only accepts one or two parameters", $expression);
     }
     /**
      * Process the expected symbol to be returned
      */
     $call->processExpectedReturn($context);
     $symbolVariable = $call->getSymbolVariable();
     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/object');
     $symbolVariable->setDynamicTypes('string');
     $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression);
     if (!isset($resolvedParams[1])) {
         $context->codePrinter->output('zephir_get_class_ns(' . $symbolVariable->getName() . ', ' . $resolvedParams[0] . ', 0 TSRMLS_CC);');
     } else {
         $context->codePrinter->output('zephir_get_class_ns(' . $symbolVariable->getName() . ', ' . $resolvedParams[0] . ', ' . $resolvedParams[1] . ' TSRMLS_CC);');
     }
     return new CompiledExpression('variable', $symbolVariable->getRealName(), $expression);
 }
开发者ID:NumbDai,项目名称:zephir,代码行数:37,代码来源:GetClassNsOptimizer.php

示例11: 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']) != 2) {
         return false;
     }
     /**
      * Process the expected symbol to be returned
      */
     $call->processExpectedReturn($context);
     $symbolVariable = $call->getSymbolVariable();
     if ($symbolVariable->isNotVariableAndString()) {
         throw new CompilerException("Returned values by functions can only be assigned to variant variables", $expression);
     }
     if ($expression['parameters'][0]['parameter']['type'] == 'string') {
         $str = Utils::addSlashes($expression['parameters'][0]['parameter']['value']);
         unset($expression['parameters'][0]);
     }
     if ($call->mustInitSymbolVariable()) {
         $symbolVariable->initVariant($context);
     }
     $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression);
     $context->headersManager->add('kernel/string');
     $symbolVariable->setDynamicTypes('string');
     if (isset($str)) {
         $context->codePrinter->output('zephir_fast_join_str(' . $symbolVariable->getName() . ', SL("' . $str . '"), ' . $resolvedParams[0] . ' TSRMLS_CC);');
         return new CompiledExpression('variable', $symbolVariable->getRealName(), $expression);
     }
     $context->codePrinter->output('zephir_fast_join(' . $symbolVariable->getName() . ', ' . $resolvedParams[0] . ', ' . $resolvedParams[1] . ' TSRMLS_CC);');
     return new CompiledExpression('variable', $symbolVariable->getRealName(), $expression);
 }
开发者ID:NumbDai,项目名称:zephir,代码行数:40,代码来源:ImplodeOptimizer.php

示例12: 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("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('owl/annotations/scanner', HeadersManager::POSITION_LAST);
     $context->headersManager->add('owl/annotations/annot', HeadersManager::POSITION_LAST);
     $symbolVariable->setDynamicTypes('array');
     $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression);
     $context->codePrinter->output('phannot_parse_annotations(' . $symbolVariable->getName() . ', ' . $resolvedParams[0] . ', ' . $resolvedParams[1] . ', ' . $resolvedParams[2] . ' TSRMLS_CC);');
     return new CompiledExpression('variable', $symbolVariable->getRealName(), $expression);
 }
开发者ID:noikiy,项目名称:owl,代码行数:33,代码来源:ParseAnnotationsOptimizer.php

示例13: 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);
 }
开发者ID:mattvb91,项目名称:cphalcon,代码行数:32,代码来源:PhalconGetUriOptimizer.php

示例14: 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;
     }
     $charlist = 'NULL ';
     if (count($expression['parameters']) == 2) {
         if ($expression['parameters'][1]['parameter']['type'] == 'null') {
             unset($expression['parameters'][1]);
         }
     }
     /**
      * Process the expected symbol to be returned
      */
     $call->processExpectedReturn($context);
     $symbolVariable = $call->getSymbolVariable();
     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/string');
     $symbolVariable->setDynamicTypes('string');
     $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression);
     if (isset($resolvedParams[1])) {
         $charlist = $resolvedParams[1];
     }
     $context->codePrinter->output('zephir_fast_trim(' . $symbolVariable->getName() . ', ' . $resolvedParams[0] . ', ' . $charlist . ', ' . static::$TRIM_WHERE . ' TSRMLS_CC);');
     return new CompiledExpression('variable', $symbolVariable->getRealName(), $expression);
 }
开发者ID:NumbDai,项目名称:zephir,代码行数:38,代码来源:TrimOptimizer.php

示例15: 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']) != 2) {
         return false;
     }
     $context->headersManager->add('kernel/file');
     /**
      * Process the expected symbol to be returned
      */
     $call->processExpectedReturn($context);
     $symbolVariable = $call->getSymbolVariable();
     if ($symbolVariable) {
         if ($symbolVariable->isNotVariableAndString()) {
             throw new CompilerException("Returned values by functions can only be assigned to variant variables", $expression);
         }
     }
     $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression);
     if ($symbolVariable) {
         if ($call->mustInitSymbolVariable()) {
             $symbolVariable->initVariant($context);
         }
         $context->codePrinter->output('zephir_file_put_contents(' . $symbolVariable->getName() . ', ' . $resolvedParams[0] . ', ' . $resolvedParams[1] . ' TSRMLS_CC);');
         return new CompiledExpression('variable', $symbolVariable->getRealName(), $expression);
     } else {
         $context->codePrinter->output('zephir_file_put_contents(NULL, ' . $resolvedParams[0] . ', ' . $resolvedParams[1] . ' TSRMLS_CC);');
     }
     return new CompiledExpression('null', 'null', $expression);
 }
开发者ID:edin,项目名称:zephir,代码行数:38,代码来源:FilePutContentsOptimizer.php


注:本文中的Zephir\Call类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。