Code Duplication    Length = 4-6 lines in 2 locations

class.json-api-endpoints.php 2 locations

@@ 419-422 (lines=4) @@
416
			case 'string':
417
				// Fallback string -> array, or for string -> object
418
				if ( is_array( $value ) || is_object( $value ) ) {
419
					if ( ! empty( $types[0] ) ) {
420
						$next_type = array_shift( $types );
421
						return $this->cast_and_filter_item( $return, $next_type, $key, $value, $types, $for_output );
422
					}
423
				}
424
425
				// Fallback string -> false
@@ 464-469 (lines=6) @@
461
				// nobreak
462
			case 'array':
463
				// Fallback array -> string
464
				if ( is_string( $value ) ) {
465
					if ( ! empty( $types[0] ) ) {
466
						$next_type = array_shift( $types );
467
						return $this->cast_and_filter_item( $return, $next_type, $key, $value, $types, $for_output );
468
					}
469
				}
470
471
				if ( isset( $type['children'] ) ) {
472
					$children = array();