Code Duplication    Length = 3-3 lines in 3 locations

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

@@ 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-themes-install-endpoint.php 1 location

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