From def74f7b6df1d3a7bbdd9ee22792930411481015 Mon Sep 17 00:00:00 2001 From: Ryan Cramer Date: Fri, 19 Apr 2024 11:48:07 -0400 Subject: [PATCH] Minor refactor of WireArray::__toString() method --- wire/core/WireArray.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/wire/core/WireArray.php b/wire/core/WireArray.php index 0f1fa0b7..3a1dcc5b 100644 --- a/wire/core/WireArray.php +++ b/wire/core/WireArray.php @@ -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); } /**