Code Duplication    Length = 3-3 lines in 3 locations

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

@@ 57-59 (lines=3) @@
54
	}
55
56
	protected function validate_plugins() {
57
		if ( empty( $this->plugins ) || ! is_array( $this->plugins ) ) {
58
			return new WP_Error( 'missing_plugins', __( 'No plugins found.', 'jetpack' ) );
59
		}
60
		foreach( $this->plugins as $index => $slug ) {
61
			// make sure it is not already installed
62
			if ( self::get_plugin_id_by_slug( $slug ) ) {

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

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

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

@@ 86-88 (lines=3) @@
83
	 * @return bool|WP_Error
84
	 */
85
	protected function validate_plugins() {
86
		if ( empty( $this->plugins ) || ! is_array( $this->plugins ) ) {
87
			return new WP_Error( 'missing_plugins', __( 'No plugins found.', 'jetpack' ));
88
		}
89
		foreach( $this->plugins as $index => $plugin ) {
90
			if ( ! preg_match( "/\.php$/", $plugin ) ) {
91
				$plugin =  $plugin . '.php';