Code Duplication    Length = 6-6 lines in 4 locations

src/wp-includes/capabilities.php 4 locations

@@ 81-86 (lines=6) @@
78
		}
79
80
		$post_type = get_post_type_object( $post->post_type );
81
		if ( ! $post_type ) {
82
			/* translators: 1: post type, 2: capability name */
83
			_doing_it_wrong( __FUNCTION__, sprintf( __( 'The post type %1$s is not registered, so it may not be reliable to check the capability "%2$s" against a post of that type.' ), $post->post_type, $cap ), '4.4.0' );
84
			$caps[] = 'edit_others_posts';
85
			break;
86
		}
87
88
		if ( ! $post_type->map_meta_cap ) {
89
			$caps[] = $post_type->cap->$cap;
@@ 142-147 (lines=6) @@
139
		}
140
141
		$post_type = get_post_type_object( $post->post_type );
142
		if ( ! $post_type ) {
143
			/* translators: 1: post type, 2: capability name */
144
			_doing_it_wrong( __FUNCTION__, sprintf( __( 'The post type %1$s is not registered, so it may not be reliable to check the capability "%2$s" against a post of that type.' ), $post->post_type, $cap ), '4.4.0' );
145
			$caps[] = 'edit_others_posts';
146
			break;
147
		}
148
149
		if ( ! $post_type->map_meta_cap ) {
150
			$caps[] = $post_type->cap->$cap;
@@ 201-206 (lines=6) @@
198
		}
199
200
		$post_type = get_post_type_object( $post->post_type );
201
		if ( ! $post_type ) {
202
			/* translators: 1: post type, 2: capability name */
203
			_doing_it_wrong( __FUNCTION__, sprintf( __( 'The post type %1$s is not registered, so it may not be reliable to check the capability "%2$s" against a post of that type.' ), $post->post_type, $cap ), '4.4.0' );
204
			$caps[] = 'edit_others_posts';
205
			break;
206
		}
207
208
		if ( ! $post_type->map_meta_cap ) {
209
			$caps[] = $post_type->cap->$cap;
@@ 238-243 (lines=6) @@
235
		}
236
237
		$post_type = get_post_type_object( $post->post_type );
238
		if ( ! $post_type ) {
239
			/* translators: 1: post type, 2: capability name */
240
			_doing_it_wrong( __FUNCTION__, sprintf( __( 'The post type %1$s is not registered, so it may not be reliable to check the capability "%2$s" against a post of that type.' ), $post->post_type, $cap ), '4.4.0' );
241
			$caps[] = 'edit_others_posts';
242
			break;
243
		}
244
245
		$caps[] = $post_type->cap->publish_posts;
246
		break;