Code Duplication    Length = 12-12 lines in 2 locations

core/Field/Set_Field.php 1 location

@@ 55-66 (lines=12) @@
52
	 * @param  array $input Array of field names and values.
53
	 * @return Field $this
54
	 */
55
	public function set_value_from_input( $input ) {
56
		if ( ! isset( $input[ $this->name ] ) ) {
57
			$this->set_value( array() );
58
		} else {
59
			$value = stripslashes_deep( $input[ $this->name ] );
60
			if ( is_array( $value ) ) {
61
				$value = array_values( $value );
62
			}
63
			$this->set_value( $value );
64
		}
65
		return $this;
66
	}
67
68
	/**
69
	 * Returns an array that holds the field data, suitable for JSON representation.

core/Field/Media_Gallery_Field.php 1 location

@@ 91-102 (lines=12) @@
88
	 * @param  array $input Array of field names and values.
89
	 * @return Field $this
90
	 */
91
	public function set_value_from_input( $input ) {
92
		if ( ! isset( $input[ $this->name ] ) ) {
93
			$this->set_value( array() );
94
		} else {
95
			$value = stripslashes_deep( $input[ $this->name ] );
96
			if ( is_array( $value ) ) {
97
				$value = array_values( $value );
98
			}
99
			$this->set_value( $value );
100
		}
101
		return $this;
102
	}
103
104
	/**
105
	 * Converts the field values into a usable associative array.