Code Duplication    Length = 3-3 lines in 3 locations

json-endpoints/jetpack/class.jetpack-json-api-plugins-install-endpoint.php 1 location

@@ 81-83 (lines=3) @@
78
	}
79
80
	protected function validate_plugins() {
81
		if ( empty( $this->plugins ) || ! is_array( $this->plugins ) ) {
82
			return new WP_Error( 'missing_plugins', __( 'No plugins found.', 'jetpack' ) );
83
		}
84
85
		jetpack_require_lib( 'plugins' );
86
		foreach ( $this->plugins as $index => $slug ) {

json-endpoints/jetpack/class.jetpack-json-api-plugins-endpoint.php 1 location

@@ 108-110 (lines=3) @@
105
	 * @return bool|WP_Error
106
	 */
107
	protected function validate_plugins() {
108
		if ( empty( $this->plugins ) || ! is_array( $this->plugins ) ) {
109
			return new WP_Error( 'missing_plugins', __( 'No plugins found.', 'jetpack' ));
110
		}
111
		foreach( $this->plugins as $index => $plugin ) {
112
			if ( ! preg_match( "/\.php$/", $plugin ) ) {
113
				$plugin =  $plugin . '.php';

json-endpoints/jetpack/class.jetpack-json-api-themes-install-endpoint.php 1 location

@@ 81-83 (lines=3) @@
78
	}
79
80
	protected function validate_themes() {
81
		if ( empty( $this->themes ) || ! is_array( $this->themes ) ) {
82
			return new WP_Error( 'missing_themes', __( 'No themes found.', 'jetpack' ) );
83
		}
84
		foreach( $this->themes as $index => $theme ) {
85
86
			if ( self::is_installed_theme( $theme ) ) {