$value) { if ($excludeMode === true) { if (!in_array($key, $ignoreProperties)) { $retAr[$key] = $value; } } else { // include mode if (in_array($key, $ignoreProperties)) { $retAr[$key] = $value; } } } return $retAr; } /** * class property to String. * * @param array $ignoreProperties this properties to be excluded from String. * @param bool $excludeMode * * @return string */ public function toString(array $ignoreProperties = [], bool $excludeMode = true): string { $ar = $this->toArray($ignoreProperties, $excludeMode); return json_encode($ar, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE); } }