コード例 #1
0
 /**
  * @dataProvider provideTrackPrefixesParsing
  */
 public function testTrackPrefixesParsing($input, $expected)
 {
     $usageValidator = new UsageValidator();
     $usageValidator->trackUsedPrefixes($input);
     $this->setExpectedException('RangeException', $expected);
     $usageValidator->validate();
 }
コード例 #2
0
ファイル: GraphBuilder.php プロジェクト: benestar/asparagus
 /**
  * Adds the given expression as a filter to this query.
  *
  * @param string $expression
  * @return self
  * @throws InvalidArgumentException
  */
 public function filter($expression)
 {
     $this->expressionValidator->validate($expression, ExpressionValidator::VALIDATE_FUNCTION);
     $this->usageValidator->trackUsedPrefixes($expression);
     $this->usageValidator->trackUsedVariables($expression);
     $this->filters[] = '(' . $expression . ')';
     return $this;
 }
コード例 #3
0
ファイル: QueryBuilder.php プロジェクト: benestar/asparagus
 private function addExpressions(array $expressions, $options = null)
 {
     foreach ($expressions as $expression) {
         $this->expressionValidator->validate($expression, $options ?: ExpressionValidator::VALIDATE_VARIABLE | ExpressionValidator::VALIDATE_FUNCTION_AS);
         // @todo temp hack to add AS definitions to defined variables
         $regexHelper = new RegexHelper();
         $matches = $regexHelper->getMatches('AS \\{variable}', $expression);
         $this->usageValidator->trackDefinedVariables($matches);
         // @todo detect functions and wrap with brackets automatically
         $this->usageValidator->trackUsedVariables($expression);
         $this->usageValidator->trackUsedPrefixes($expression);
         $this->selects[] = $expression;
     }
 }