1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-08 15:57:01 +02:00

Minor refactor of WireArray::__toString() method

This commit is contained in:
Ryan Cramer
2024-04-19 11:48:07 -04:00
parent 7a85039896
commit def74f7b6d

View File

@@ -1934,13 +1934,15 @@ class WireArray extends Wire implements \IteratorAggregate, \ArrayAccess, \Count
*
*/
public function __toString() {
$s = '';
foreach($this as $value) {
$values = array();
foreach($this->data as $value) {
if(is_array($value)) $value = "array(" . count($value) . ")";
$s .= "$value|";
$value = (string) $value;
if(!strlen($value)) continue;
if(strpos($value, '|') !== false) $value = str_replace('|', ' ', $value);
$values[] = $value;
}
$s = rtrim($s, '|');
return $s;
return implode('|', $values);
}
/**