コード例 #1
0
 protected function removeGetTrueIteratorCall(O\Expression $queryExpression)
 {
     //Removes the ->getTrueIterator() method call expression so when
     //searching for applicable results the expression will be a common ancestor
     if ($queryExpression instanceof O\MethodCallExpression) {
         $nameExpression = $queryExpression->getName();
         if ($nameExpression instanceof O\ValueExpression) {
             if (strtolower($nameExpression->getValue()) === 'gettrueiterator') {
                 return $queryExpression->getValue();
             }
         }
     }
     return $queryExpression;
 }
コード例 #2
0
ファイル: ScopeInterpreter.php プロジェクト: timetoogo/pinq
 protected final function visit(O\Expression $expression)
 {
     if ($expression instanceof O\ValueExpression) {
         $queryable = $expression->getValue();
         if (!$queryable instanceof IQueryable) {
             throw new PinqException('Invalid scope expression: must originate from %s, %s given', IQueryable::IQUERYABLE_TYPE, Utilities::getTypeOrClass($queryable));
         }
         if ($queryable->isSource()) {
             $this->addSegment(function () use($queryable) {
                 $this->interpretation->interpretScopeSource($queryable);
             });
             return;
         }
         $expression = $queryable->getExpression();
     }
     $methodName = $this->getMethodName($expression);
     $this->segmentCounter++;
     $this->segmentId = "{$this->segmentCounter}-{$methodName}";
     if (!method_exists($this, "visit{$methodName}")) {
         throw new PinqException('Cannot interpret query scope with method call \'%s\'', $methodName);
     }
     $this->{"visit{$methodName}"}($expression);
 }
コード例 #3
0
ファイル: ExpressionAnalyser.php プロジェクト: timetoogo/pinq
 protected function validateStaticClassName(O\Expression $expression, $type)
 {
     if ($expression instanceof O\ValueExpression) {
         return $expression->getValue();
     } else {
         throw new TypeException('Invalid %s expression: dynamic class types are not supported', $type);
     }
 }
コード例 #4
0
 /**
  * Updates the matched expression with it's resolved value from
  * the supplied registry.
  *
  * @param IFunction $function
  * @param O\Expression $expression
  * @param Parameters\ResolvedParameterRegistry $parameters
  *
  * @return O\Expression
  */
 public function inline(IFunction $function, O\Expression $expression, Parameters\ResolvedParameterRegistry $parameters)
 {
     /** @var O\InvocationExpression $expression */
     return O\Expression::functionCall(O\Expression::value($this->getResolvedValue($parameters, $expression->getValue())), $expression->getArguments());
 }
コード例 #5
0
ファイル: ObjectType.php プロジェクト: timetoogo/pinq
 protected function getFieldByName(O\Expression $nameExpression, $static)
 {
     if ($nameExpression instanceof O\ValueExpression) {
         $fieldName = $nameExpression->getValue();
         foreach ($this->fields as $otherFieldName => $field) {
             if ($field->isStatic() === $static && strcasecmp($fieldName, $otherFieldName) === 0) {
                 return $field;
             }
         }
     }
     return null;
 }