/** * By default return the value. * This can be dangerous if used in a loop! * There is a PHP bug that caches it's * output when used in a loop. * Take heed. * * @return string */ public function __toString() { $value = $this->object->getValue(); if (is_array($value) || is_object($value)) { return json_encode($value); } return (string) $this->object->getValue(); }