Pinq\Tests\Integration\Providers\DSL\Implementation\English\QueryCompilation::appendSource PHP Method

appendSource() public method

public appendSource ( Pinq\Queries\Common\ISource $source, $d = false )
$source Pinq\Queries\Common\ISource
    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(']');
        }
    }

Usage Example

Example #1
0
 public function visitOperation(Segments\Operation $query)
 {
     $textMap = [Segments\Operation::APPEND => 'Append with: ', Segments\Operation::DIFFERENCE => 'The difference from: ', Segments\Operation::EXCEPT => 'Where not contained in: ', Segments\Operation::INTERSECT => 'The intersection with: ', Segments\Operation::UNION => 'The union with: ', Segments\Operation::WHERE_IN => 'Where contained in: '];
     $this->compilation->append($textMap[$query->getOperationType()]);
     $this->compilation->appendSource($query->getSource(), true);
     $this->compilation->appendLine();
 }
All Usage Examples Of Pinq\Tests\Integration\Providers\DSL\Implementation\English\QueryCompilation::appendSource