Code Duplication    Length = 4-4 lines in 2 locations

core/Container/Container.php 1 location

@@ 159-162 (lines=4) @@
156
			$id = $repository->get_unique_container_id( $name );
157
		}
158
159
		if ( ! preg_match( '/\A[a-z0-9_]+\z/', $id ) ) {
160
			Incorrect_Syntax_Exception::raise( 'Container IDs can only contain lowercase alphanumeric characters and underscores ("' . $id . '" passed).' );
161
			return null;
162
		}
163
164
		if ( ! $repository->is_unique_container_id( $id ) ) {
165
			Incorrect_Syntax_Exception::raise( 'The passed container id is already taken ("' . $id . '" passed).' );

core/Field/Field.php 1 location

@@ 230-233 (lines=4) @@
227
228
		// stop hidden symbol support when the end user is creating fields ]-[
229
		// @see Field::set_name()
230
		if ( ! empty( $name ) && ! preg_match( '/\A[a-z0-9_]+\z/', $name ) ) {
231
			Incorrect_Syntax_Exception::raise( 'Field name can only contain lowercase alphanumeric characters and underscores ("' . $name . '" passed).' );
232
			return;
233
		}
234
235
		if ( Carbon_Fields::has( $type, 'fields' ) ) {
236
			return Carbon_Fields::resolve_with_arguments( $type, array(