Code Duplication    Length = 4-6 lines in 2 locations

class.json-api-endpoints.php 2 locations

@@ 366-369 (lines=4) @@
363
		case 'string' :
364
			// Fallback string -> array, or for string -> object
365
			if ( is_array( $value ) || is_object( $value ) ) {
366
				if ( !empty( $types[0] ) ) {
367
					$next_type = array_shift( $types );
368
					return $this->cast_and_filter_item( $return, $next_type, $key, $value, $types, $for_output );
369
				}
370
			}
371
372
			// Fallback string -> false
@@ 411-416 (lines=6) @@
408
			// nobreak
409
		case 'array' :
410
			// Fallback array -> string
411
			if ( is_string( $value ) ) {
412
				if ( !empty( $types[0] ) ) {
413
					$next_type = array_shift( $types );
414
					return $this->cast_and_filter_item( $return, $next_type, $key, $value, $types, $for_output );
415
				}
416
			}
417
418
			if ( isset( $type['children'] ) ) {
419
				$children = array();