File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed
Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -242,7 +242,7 @@ public function setAsObject(bool $bool) {
242242 * @since 1.0
243243 */
244244 public function setName (string $ name ) : bool {
245- $ keyValidity = self ::_isValidKey ($ name , $ this ->getStyle ());
245+ $ keyValidity = self ::isValidKey ($ name , $ this ->getStyle ());
246246
247247 if ($ keyValidity === false ) {
248248 return false ;
@@ -293,12 +293,14 @@ public function setStyle(string $style) {
293293 * @since 1.0
294294 */
295295 public function setValue ($ val ) {
296- if (is_subclass_of ($ val , 'webfiori \\json \\JsonI ' )) {
296+ $ this ->datatype = gettype ($ val );
297+
298+ if ($ this ->getType () == 'object ' && is_subclass_of ($ val , 'webfiori \\json \\JsonI ' )) {
297299 $ this ->value = $ val ->toJSON ();
298300 } else {
299301 $ this ->value = $ val ;
300302 }
301- $ this -> datatype = gettype ( $ val );
303+
302304 }
303305 /**
304306 * Checks if the key is a valid key string.
@@ -312,7 +314,7 @@ public function setValue($val) {
312314 *
313315 * @since 1.0
314316 */
315- private static function _isValidKey ($ key , $ style = 'kebab ' ) {
317+ private static function isValidKey ($ key , $ style = 'kebab ' ) {
316318 $ trimmedKey = trim ($ key );
317319
318320 if (strlen ($ trimmedKey ) != 0 ) {
You can’t perform that action at this time.
0 commit comments