Code Duplication    Length = 5-6 lines in 2 locations

class.json-api-endpoints.php 2 locations

@@ 406-411 (lines=6) @@
403
			}
404
405
			// Fallback string -> false
406
			if ( !is_string( $value ) ) {
407
				if ( !empty( $types[0] ) && 'false' === $types[0]['type'] ) {
408
					$next_type = array_shift( $types );
409
					return $this->cast_and_filter_item( $return, $next_type, $key, $value, $types, $for_output );
410
				}
411
			}
412
			$return[$key] = (string) $value;
413
			break;
414
		case 'html' :
@@ 485-489 (lines=5) @@
482
			break;
483
		case 'object' :
484
			// Fallback object -> false
485
			if ( is_scalar( $value ) || is_null( $value ) ) {
486
				if ( !empty( $types[0] ) && 'false' === $types[0]['type'] ) {
487
					return $this->cast_and_filter_item( $return, 'false', $key, $value, $types, $for_output );
488
				}
489
			}
490
491
			if ( isset( $type['children'] ) ) {
492
				$children = array();