Code Duplication    Length = 4-6 lines in 2 locations

class.json-api-endpoints.php 2 locations

@@ 413-416 (lines=4) @@
410
			case 'string':
411
				// Fallback string -> array, or for string -> object
412
				if ( is_array( $value ) || is_object( $value ) ) {
413
					if ( ! empty( $types[0] ) ) {
414
						$next_type = array_shift( $types );
415
						return $this->cast_and_filter_item( $return, $next_type, $key, $value, $types, $for_output );
416
					}
417
				}
418
419
				// Fallback string -> false
@@ 458-463 (lines=6) @@
455
				// nobreak
456
			case 'array':
457
				// Fallback array -> string
458
				if ( is_string( $value ) ) {
459
					if ( ! empty( $types[0] ) ) {
460
						$next_type = array_shift( $types );
461
						return $this->cast_and_filter_item( $return, $next_type, $key, $value, $types, $for_output );
462
					}
463
				}
464
465
				if ( isset( $type['children'] ) ) {
466
					$children = array();