Code Duplication    Length = 5-6 lines in 2 locations

class.json-api-endpoints.php 2 locations

@@ 373-378 (lines=6) @@
370
			}
371
372
			// Fallback string -> false
373
			if ( !is_string( $value ) ) {
374
				if ( !empty( $types[0] ) && 'false' === $types[0]['type'] ) {
375
					$next_type = array_shift( $types );
376
					return $this->cast_and_filter_item( $return, $next_type, $key, $value, $types, $for_output );
377
				}
378
			}
379
			$return[$key] = (string) $value;
380
			break;
381
		case 'html' :
@@ 452-456 (lines=5) @@
449
			break;
450
		case 'object' :
451
			// Fallback object -> false
452
			if ( is_scalar( $value ) || is_null( $value ) ) {
453
				if ( !empty( $types[0] ) && 'false' === $types[0]['type'] ) {
454
					return $this->cast_and_filter_item( $return, 'false', $key, $value, $types, $for_output );
455
				}
456
			}
457
458
			if ( isset( $type['children'] ) ) {
459
				$children = array();