Code Duplication    Length = 5-6 lines in 2 locations

class.json-api-endpoints.php 2 locations

@@ 385-390 (lines=6) @@
382
			}
383
384
			// Fallback string -> false
385
			if ( !is_string( $value ) ) {
386
				if ( !empty( $types[0] ) && 'false' === $types[0]['type'] ) {
387
					$next_type = array_shift( $types );
388
					return $this->cast_and_filter_item( $return, $next_type, $key, $value, $types, $for_output );
389
				}
390
			}
391
			$return[$key] = (string) $value;
392
			break;
393
		case 'html' :
@@ 464-468 (lines=5) @@
461
			break;
462
		case 'object' :
463
			// Fallback object -> false
464
			if ( is_scalar( $value ) || is_null( $value ) ) {
465
				if ( !empty( $types[0] ) && 'false' === $types[0]['type'] ) {
466
					return $this->cast_and_filter_item( $return, 'false', $key, $value, $types, $for_output );
467
				}
468
			}
469
470
			if ( isset( $type['children'] ) ) {
471
				$children = array();