You are here

public function ConditionGroup::__toString in Entity API 8

Gets the string representation of the condition group.

Return value

string The string representation of the condition group.

File

src/QueryAccess/ConditionGroup.php, line 169

Class

ConditionGroup
Represents a group of query access conditions.

Namespace

Drupal\entity\QueryAccess

Code

public function __toString() {

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