Author: Elliot Levin (elliotlevin@hotmail.com)
示例#1
0
 public function processSource(Queries\Common\ISource $source)
 {
     if ($source instanceof Queries\Common\Source\QueryScope) {
         $processor = $this->forSubScope($source->getScope());
         return $source->update($processor->buildScope());
     }
     return $source;
 }
示例#2
0
 public function appendSource(Queries\Common\ISource $source, $d = false)
 {
     if ($source instanceof Queries\Common\Source\ArrayOrIterator) {
         $this->append('[array or iterator]');
     } elseif ($source instanceof Queries\Common\Source\SingleValue) {
         $this->append('[single value]');
     } elseif ($source instanceof Queries\Common\Source\QueryScope) {
         $compilation = new self();
         $compiler = new ScopeCompiler($compilation, $source->getScope());
         $compiler->compile();
         $this->appendLine('[');
         foreach (array_filter(explode(PHP_EOL, $compilation->asCompiled())) as $line) {
             $this->appendLine('    ' . $line);
         }
         $this->append(']');
     }
 }
示例#3
0
 public static function evaluateSource(Common\ISource $source, Queries\IResolvedParameterRegistry $resolvedParameters)
 {
     if ($source instanceof Common\Source\ArrayOrIterator) {
         return $resolvedParameters[$source->getId()];
     } elseif ($source instanceof Common\Source\SingleValue) {
         return [$resolvedParameters[$source->getId()]];
     } elseif ($source instanceof Common\Source\QueryScope) {
         return self::evaluate($source->getScope(), $resolvedParameters);
     }
 }
示例#4
0
 public function getParameters()
 {
     return $this->source->getParameters();
 }
示例#5
0
 public function getParameters()
 {
     return array_merge($this->source->getParameters(), $this->filter === null ? [] : $this->filter->getParameters(), $this->hasDefault ? [$this->defaultValueId, $this->defaultKeyId] : []);
 }