Code Duplication    Length = 12-12 lines in 2 locations

_inc/lib/class.core-rest-api-endpoints.php 2 locations

@@ 747-758 (lines=12) @@
744
				$error = '';
745
746
				$activated_count = count( $activated );
747
				if ( $activated_count > 0 ) {
748
					$activated_last = array_pop( $activated );
749
					$activated_text = $activated_count > 1 ? sprintf(
750
						/* Translators: first variable is a list followed by a last item. Example: dog, cat and bird. */
751
						__( '%s and %s', 'jetpack' ),
752
						join( ', ', $activated ), $activated_last ) : $activated_last;
753
754
					$error = sprintf(
755
						/* Translators: the plural variable is a list followed by a last item. Example: dog, cat and bird. */
756
						_n( 'The module %s was activated.', 'The modules %s were activated.', $activated_count, 'jetpack' ),
757
						$activated_text ) . ' ';
758
				}
759
760
				$failed_count = count( $failed );
761
				if ( count( $failed ) > 0 ) {
@@ 761-772 (lines=12) @@
758
				}
759
760
				$failed_count = count( $failed );
761
				if ( count( $failed ) > 0 ) {
762
					$failed_last = array_pop( $failed );
763
					$failed_text = $failed_count > 1 ? sprintf(
764
						/* Translators: first variable is a list followed by a last item. Example: dog, cat and bird. */
765
						__( '%s and %s', 'jetpack' ),
766
						join( ', ', $failed ), $failed_last ) : $failed_last;
767
768
					$error = sprintf(
769
						/* Translators: the plural variable is a list followed by a last item. Example: dog, cat and bird. */
770
						_n( 'The module %s failed to be activated.', 'The modules %s failed to be activated.', $failed_count, 'jetpack' ),
771
						$failed_text ) . ' ';
772
				}
773
			}
774
			return new WP_Error( 'activation_failed', esc_html( $error ), array( 'status' => 424 ) );
775
		}