Code Duplication    Length = 3-3 lines in 3 locations

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

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

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

@@ 53-55 (lines=3) @@
50
	}
51
52
	protected function validate_themes() {
53
		if ( empty( $this->themes ) || ! is_array( $this->themes ) ) {
54
			return new WP_Error( 'missing_themes', __( 'No themes found.', 'jetpack' ) );
55
		}
56
		foreach( $this->themes as $index => $theme ) {
57
58
			if ( self::is_installed_theme( $theme ) ) {