Code Duplication    Length = 5-6 lines in 2 locations

class.json-api-endpoints.php 2 locations

@@ 411-416 (lines=6) @@
408
			}
409
410
			// Fallback string -> false
411
			if ( !is_string( $value ) ) {
412
				if ( !empty( $types[0] ) && 'false' === $types[0]['type'] ) {
413
					$next_type = array_shift( $types );
414
					return $this->cast_and_filter_item( $return, $next_type, $key, $value, $types, $for_output );
415
				}
416
			}
417
			$return[$key] = (string) $value;
418
			break;
419
		case 'html' :
@@ 490-494 (lines=5) @@
487
			break;
488
		case 'object' :
489
			// Fallback object -> false
490
			if ( is_scalar( $value ) || is_null( $value ) ) {
491
				if ( !empty( $types[0] ) && 'false' === $types[0]['type'] ) {
492
					return $this->cast_and_filter_item( $return, 'false', $key, $value, $types, $for_output );
493
				}
494
			}
495
496
			if ( isset( $type['children'] ) ) {
497
				$children = array();