You are here

public function ConditionGroup::__toString in Search API 8

Implements the magic __toString() method to simplify debugging.

File

src/Query/ConditionGroup.php, line 108

Class

ConditionGroup
Provides a standard implementation for a Search API query condition group.

Namespace

Drupal\search_api\Query

Code

public function __toString() {

  // Special case for a single, nested condition group:
  if (count($this->conditions) == 1) {
    return (string) reset($this->conditions);
  }
  $ret = [];
  foreach ($this->conditions as $condition) {
    $ret[] = str_replace("\n", "\n  ", (string) $condition);
  }
  return $ret ? "[\n  " . implode("\n{$this->conjunction}\n  ", $ret) . "\n]" : '';
}