Code Duplication    Length = 3-3 lines in 3 locations

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

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

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

@@ 102-104 (lines=3) @@
99
	}
100
101
	protected function validate_plugins() {
102
		if ( empty( $this->plugins ) || ! is_array( $this->plugins ) ) {
103
			return new WP_Error( 'missing_plugins', __( 'No plugins found.', 'jetpack' ) );
104
		}
105
		foreach ( $this->plugins as $index => $slug ) {
106
			// make sure it is not already installed
107
			if ( self::get_plugin_id_by_slug( $slug ) ) {