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


PHP Expression类代码示例

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


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

示例1: compileType

 protected function compileType(&$code, Expression $typeExpression)
 {
     if ($typeExpression instanceof ValueExpression) {
         $code .= $typeExpression->getValue();
     } else {
         $typeExpression->compileCode($code);
     }
 }
开发者ID:timetoogo,项目名称:pinq,代码行数:8,代码来源:StaticClassExpression.php

示例2: getNextOccurrence

 /**
  * Returns the next valid date after the provided $dateTime object.
  *
  * @param DateTime $dateTime
  * @return DateTime
  */
 public function getNextOccurrence(\DateTime $dateTime)
 {
     $firstNextOccurrnece = $this->firstExpression->getNextOccurrence($dateTime);
     if (!$this->contains($firstNextOccurrnece)) {
         $firstNextOccurrnece = $this->getNextOccurrence($firstNextOccurrnece);
     }
     return $firstNextOccurrnece;
 }
开发者ID:robzienert,项目名称:TemporalExpression,代码行数:14,代码来源:Difference.php

示例3: addCondition

 /**
  * @param   mixed   $value
  * @param   string  $operator
  * @param   boolean $iscolumn
  */
 protected function addCondition($value, $operator, $iscolumn)
 {
     if ($iscolumn && is_string($value)) {
         $expr = new Expression($this->compiler);
         $value = $expr->column($value);
     }
     $this->havingClause->addCondition($this->aggregate, $value, $operator, $this->separator);
 }
开发者ID:cgslivre,项目名称:database-1,代码行数:13,代码来源:Having.php

示例4: add

 /**
  * add
  * 
  * @param Expression $expr 
  * @access public
  * @return void
  */
 public function add(Expression $expr)
 {
     if (!$expr instanceof OrderExpression) {
         throw new \InvalidArgumentException('OrderClause only accept OrderExpression as its part.');
     }
     // internal Expression has to be an unique by field
     $this->expressions[$expr->getField()->getName()] = $expr;
     return $this;
 }
开发者ID:o3co,项目名称:query,代码行数:16,代码来源:OrderClause.php

示例5: test_caching

 public function test_caching()
 {
     $e = '$_0 < $_1';
     $x = new Expression($e);
     // different objects w/ same expression...
     $y = new Expression($e);
     // ... should have same callable
     $this->assertSame($x->getCallable(), $y->getCallable());
 }
开发者ID:haldayne,项目名称:fox,代码行数:9,代码来源:ExpressionTest.php

示例6: compileCode

 protected function compileCode(&$code)
 {
     if ($this->name instanceof ValueExpression && self::isNormalSyntaxName($this->name->getValue())) {
         $code .= '$' . $this->name->getValue();
     } else {
         $code .= '${';
         $this->name->compileCode($code);
         $code .= '}';
     }
 }
开发者ID:timetoogo,项目名称:pinq,代码行数:10,代码来源:VariableExpression.php

示例7: compileCode

 protected function compileCode(&$code)
 {
     if ($this->name instanceof ValueExpression) {
         $code .= $this->name->getValue();
     } else {
         $this->name->compileCode($code);
     }
     $code .= '(';
     $code .= implode(',', self::compileAll($this->arguments));
     $code .= ')';
 }
开发者ID:timetoogo,项目名称:pinq,代码行数:11,代码来源:FunctionCallExpression.php

示例8: compileCode

 protected function compileCode(&$code)
 {
     $code .= '(';
     $this->leftOperand->compileCode($code);
     $code .= ' ' . $this->operator . ' ';
     if ($this->operator === Operators\Binary::IS_INSTANCE_OF && $this->rightOperand instanceof ValueExpression) {
         $code .= $this->rightOperand->getValue();
     } else {
         $this->rightOperand->compileCode($code);
     }
     $code .= ')';
 }
开发者ID:timetoogo,项目名称:pinq,代码行数:12,代码来源:BinaryOperationExpression.php

示例9: quoteTable

 public function quoteTable($value)
 {
     if ($value instanceof Criterion) {
         $value = new Expression('( ' . $value->createSql() . ' )');
     }
     if ($value instanceof Expression) {
         return $value->toString();
     }
     $this->separator = '';
     $this->implodeGlue = '.';
     return $this->_quote(explode('.', $value));
 }
开发者ID:Eximagen,项目名称:sochi,代码行数:12,代码来源:MSSqlQuoteStrategy.php

示例10: evaluate

 /**
  * @param RuleConditionExpression $rce
  * @param array $contextMap
  * @return mixed
  */
 function evaluate($rce, $contextMap)
 {
     $operator = strtoupper($rce->operator);
     $evaluator = $this->getEvaluator($operator);
     if (!$evaluator) {
         throw new MockApiException("unsupported condition operator '" . $operator . '"', ErrorInfo::UNSUPPORTED_CONDITION_OPERATOR);
     }
     $exp = new Expression();
     $exp->setLeft($this->getOperandValue($rce->left, $contextMap));
     $exp->setRight($this->getOperandValue($rce->right, $contextMap));
     $exp->setOperator($operator);
     return $evaluator->evaluate($exp);
 }
开发者ID:huhai463127310,项目名称:mockapi-php,代码行数:18,代码来源:RuleConditionExpressionEngine.php

示例11: getFilteredResultSet

 function getFilteredResultSet(&$masterResultSet, &$sqlQuery)
 {
     global $g_sqlSingleRecFuncs;
     $parser = new SqlParser($sqlQuery->where_expr);
     $king_expr = new Expression();
     $current_expr =& $king_expr;
     while (!is_empty_str($elem = $parser->parseNextElementRaw())) {
         // function ?
         if (in_array(strtoupper($elem), $g_sqlSingleRecFuncs)) {
             $current_expr->expr_str .= $elem;
             $elem = $parser->parseNextElementRaw();
             if ($elem != "(") {
                 print_error_msg("( expected after " . $current_expr->expr_str);
                 return null;
             }
             $current_expr->expr_str .= $elem;
             while (!is_empty_str($elem = $parser->parseNextElementRaw()) && $elem != ")") {
                 $current_expr->expr_str .= $elem;
             }
             $current_expr->expr_str .= $elem . " ";
             continue;
         }
         if ($elem == "(") {
             $current_expr->expr_str .= " % ";
             unset($new_expr);
             $new_expr = new Expression("");
             $current_expr->addChild($new_expr);
             $new_expr->setParent($current_expr);
             unset($current_expr);
             $current_expr =& $new_expr;
         } else {
             if ($elem == ")") {
                 unset($tmp);
                 $tmp =& $current_expr->getParent();
                 unset($current_expr);
                 $current_expr =& $tmp;
             } else {
                 // no spaces on .'s
                 if ($elem == ".") {
                     remove_last_char($current_expr->expr_str);
                     $current_expr->expr_str .= $elem;
                 } else {
                     $current_expr->expr_str .= $elem . " ";
                 }
             }
         }
     }
     return $king_expr->getFilteredResultSet($masterResultSet, $sqlQuery);
 }
开发者ID:Kent-Liang,项目名称:Network-Security,代码行数:49,代码来源:expression.php

示例12: compileCode

 protected function compileCode(&$code)
 {
     $this->value->compileCode($code);
     $code .= '->';
     if ($this->name instanceof ValueExpression && self::isNormalSyntaxName($this->name->getValue())) {
         $code .= $this->name->getValue();
     } else {
         $code .= '{';
         $this->name->compileCode($code);
         $code .= '}';
     }
     $code .= '(';
     $code .= implode(',', self::compileAll($this->arguments));
     $code .= ')';
 }
开发者ID:timetoogo,项目名称:pinq,代码行数:15,代码来源:MethodCallExpression.php

示例13: testErrors

 public function testErrors()
 {
     $form = Form::create()->add(Primitive::ternary('flag')->setFalseValue('0')->setTrueValue('1'))->add(Primitive::integer('old')->required())->addRule('someRule', Expression::between(FormField::create('old'), '18', '35'));
     //empty import
     $form->import(array())->checkRules();
     //checking
     $expectingErrors = array('old' => Form::MISSING, 'someRule' => Form::WRONG);
     $this->assertEquals($expectingErrors, $form->getErrors());
     $this->assertEquals(Form::MISSING, $form->getError('old'));
     $this->assertEquals(Form::WRONG, $form->getError('someRule'));
     $this->assertTrue($form->hasError('old'));
     $this->assertFalse($form->hasError('flag'));
     //drop errors
     $form->dropAllErrors();
     $this->assertEquals(array(), $form->getErrors());
     //import wrong data
     $form->clean()->importMore(array('flag' => '3', 'old' => '17'))->checkRules();
     //checking
     $expectingErrors = array('flag' => Form::WRONG, 'someRule' => Form::WRONG);
     $this->assertEquals($expectingErrors, $form->getErrors());
     $this->assertTrue($form->hasError('someRule'));
     //marking good and custom check errors
     $form->markGood('someRule')->markCustom('flag', 3);
     $this->assertEquals(array('flag' => 3), $form->getErrors());
     $this->assertFalse($form->hasError('someRule'));
     $this->assertNull($form->getError('someRule'));
     $this->assertEquals(3, $form->getError('flag'));
     //import right data
     $form->dropAllErrors()->clean()->importMore(array('flag' => '1', 'old' => '35'));
     //checking
     $this->assertEquals(array(), $form->getErrors());
 }
开发者ID:rero26,项目名称:onphp-framework,代码行数:32,代码来源:FormTest.class.php

示例14: testInsertFromSelect

 public function testInsertFromSelect()
 {
     $dialect = $this->getDbByType('PgSQL')->getDialect();
     $select = OSQL::select()->from('test_table2')->get('field3')->get('field_7')->andWhere(Expression::gt('field2', DBValue::create('33')));
     $insert = OSQL::insert()->setSelect($select)->into('test_table')->set('field2', 2)->set('field16', 3);
     $this->assertEquals($insert->toDialectString($dialect), 'INSERT INTO "test_table" ("field2", "field16") (' . 'SELECT "test_table2"."field3", "test_table2"."field_7" ' . 'FROM "test_table2" WHERE ("field2" > \'33\')' . ')');
 }
开发者ID:onphp-framework,项目名称:onphp-framework,代码行数:7,代码来源:OsqlInsertTest.class.php

示例15: getStyle

 /**
  * Get style of element
  *
  * @return string style of Element
  */
 protected function getStyle()
 {
     $htmlClass = $this->m_cssClass ? "class='" . $this->m_cssClass . "' " : "class='editcombobox'";
     /* 
             $width = $this->m_Width ? $this->m_Width : 146;
             $this->m_WidthInput = ($width-18).'px';
             $this->m_Width = $width.'px';
             $style = "position: absolute; width: $this->m_Width; z-index: 1; clip: rect(auto, auto, auto, $this->m_WidthInput);";
     */
     if ($this->m_Style) {
         $style .= $this->m_Style;
     }
     if (!isset($style) && !$htmlClass) {
         return null;
     }
     if (isset($style)) {
         $formObj = $this->getFormObj();
         $style = Expression::evaluateExpression($style, $formObj);
         $style = "style='{$style}'";
     }
     if ($htmlClass) {
         $style = $htmlClass . " " . $style;
     }
     return $style;
 }
开发者ID:que273,项目名称:siremis,代码行数:30,代码来源:EditCombobox.php


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