Code Duplication    Length = 5-6 lines in 2 locations

class.json-api-endpoints.php 2 locations

@@ 426-431 (lines=6) @@
423
				}
424
425
				// Fallback string -> false
426
				if ( ! is_string( $value ) ) {
427
					if ( ! empty( $types[0] ) && 'false' === $types[0]['type'] ) {
428
						$next_type = array_shift( $types );
429
						return $this->cast_and_filter_item( $return, $next_type, $key, $value, $types, $for_output );
430
					}
431
				}
432
				$return[ $key ] = (string) $value;
433
				break;
434
			case 'html':
@@ 505-509 (lines=5) @@
502
				break;
503
			case 'object':
504
				// Fallback object -> false
505
				if ( is_scalar( $value ) || is_null( $value ) ) {
506
					if ( ! empty( $types[0] ) && 'false' === $types[0]['type'] ) {
507
						return $this->cast_and_filter_item( $return, 'false', $key, $value, $types, $for_output );
508
					}
509
				}
510
511
				if ( isset( $type['children'] ) ) {
512
					$children = array();