Code Duplication    Length = 5-6 lines in 2 locations

class.json-api-endpoints.php 2 locations

@@ 366-371 (lines=6) @@
363
			}
364
365
			// Fallback string -> false
366
			if ( !is_string( $value ) ) {
367
				if ( !empty( $types[0] ) && 'false' === $types[0]['type'] ) {
368
					$next_type = array_shift( $types );
369
					return $this->cast_and_filter_item( $return, $next_type, $key, $value, $types, $for_output );
370
				}
371
			}
372
			$return[$key] = (string) $value;
373
			break;
374
		case 'html' :
@@ 444-448 (lines=5) @@
441
			break;
442
		case 'object' :
443
			// Fallback object -> false
444
			if ( is_scalar( $value ) || is_null( $value ) ) {
445
				if ( !empty( $types[0] ) && 'false' === $types[0]['type'] ) {
446
					return $this->cast_and_filter_item( $return, 'false', $key, $value, $types, $for_output );
447
				}
448
			}
449
450
			if ( isset( $type['children'] ) ) {
451
				$children = array();