You are here

public function QueryPath::textImplode in QueryPath 6

Same name and namespace in other branches
  1. 7.3 QueryPath/QueryPath.php \QueryPath::textImplode()
  2. 7.2 QueryPath/QueryPath.php \QueryPath::textImplode()

File

QueryPath/QueryPath.php, line 1234

Class

QueryPath

Code

public function textImplode($sep = ', ', $filterEmpties = TRUE) {
  $tmp = array();
  foreach ($this->matches as $m) {
    $txt = $m->textContent;
    $trimmed = trim($txt);
    if ($filterEmpties) {
      if (strlen($trimmed) > 0) {
        $tmp[] = $txt;
      }
    }
    else {
      $tmp[] = $txt;
    }
  }
  return implode($sep, $tmp);
}