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(']'); } }