Code Duplication    Length = 4-6 lines in 2 locations

class.json-api-endpoints.php 2 locations

@@ 387-390 (lines=4) @@
384
		case 'string' :
385
			// Fallback string -> array, or for string -> object
386
			if ( is_array( $value ) || is_object( $value ) ) {
387
				if ( !empty( $types[0] ) ) {
388
					$next_type = array_shift( $types );
389
					return $this->cast_and_filter_item( $return, $next_type, $key, $value, $types, $for_output );
390
				}
391
			}
392
393
			// Fallback string -> false
@@ 432-437 (lines=6) @@
429
			// nobreak
430
		case 'array' :
431
			// Fallback array -> string
432
			if ( is_string( $value ) ) {
433
				if ( !empty( $types[0] ) ) {
434
					$next_type = array_shift( $types );
435
					return $this->cast_and_filter_item( $return, $next_type, $key, $value, $types, $for_output );
436
				}
437
			}
438
439
			if ( isset( $type['children'] ) ) {
440
				$children = array();