Code Duplication    Length = 4-6 lines in 2 locations

class.json-api-endpoints.php 2 locations

@@ 428-431 (lines=4) @@
425
			case 'string':
426
				// Fallback string -> array, or for string -> object
427
				if ( is_array( $value ) || is_object( $value ) ) {
428
					if ( ! empty( $types[0] ) ) {
429
						$next_type = array_shift( $types );
430
						return $this->cast_and_filter_item( $return, $next_type, $key, $value, $types, $for_output );
431
					}
432
				}
433
434
				// Fallback string -> false
@@ 473-478 (lines=6) @@
470
				// nobreak
471
			case 'array':
472
				// Fallback array -> string
473
				if ( is_string( $value ) ) {
474
					if ( ! empty( $types[0] ) ) {
475
						$next_type = array_shift( $types );
476
						return $this->cast_and_filter_item( $return, $next_type, $key, $value, $types, $for_output );
477
					}
478
				}
479
480
				if ( isset( $type['children'] ) ) {
481
					$children = array();