private function get_minor_or_patch_updates( $items, $type ) {
		foreach ( $items as $i => $item ) {
			$wporg_url = sprintf( 'https://api.wordpress.org/plugins/info/1.0/%s.json', $item['name'] );
			$response  = Utils\http_request( 'GET', $wporg_url );
			// Must not be hosted on wp.org
			if ( 20 !== absint( substr( $response->status_code, 0, 2 ) ) ) {
				unset( $items[ $i ] );
				continue;
			}
			$data = json_decode( $response->body, true );
			// No minor or patch versions to access
			if ( empty( $data['versions'] ) ) {
				unset( $items[ $i ] );
				continue;
			}
			$update_version = false;
			$update_package = false;
			foreach ( $data['versions'] as $version => $download_link ) {
				$update_type = Utils\get_named_sem_ver( $version, $item['version'] );
				// Compared version must be older
				if ( ! $update_type ) {
					continue;
				}
				// Only permit 'patch' for 'patch'
				if ( 'patch' === $type && 'patch' !== $update_type ) {
					continue;
				}
				// Permit 'minor' or 'patch' for 'minor' phpcs:ignore Squiz.PHP.CommentedOutCode.Found -- False positive.
				if ( 'minor' === $type && ! in_array( $update_type, array( 'minor', 'patch' ), true ) ) {
					continue;
				}
				if ( $update_version && ! Comparator::greaterThan( $version, $update_version ) ) {
					continue;
				}
				$update_version = $version;
				$update_package = $download_link;
			}
			// If there's not a matching version, bail on updates
			if ( ! $update_version ) {
				unset( $items[ $i ] );
				continue;
			}
			$items[ $i ]['update_version'] = $update_version;
			$items[ $i ]['update_package'] = $update_package;
		}
		return $items;
	}
private function get_minor_or_patch_updates( $items, $type ) {
		foreach ( $items as $i => $item ) {
			$wporg_url = sprintf( 'https://api.wordpress.org/plugins/info/1.0/%s.json', $item['name'] );
			$response  = Utils\http_request( 'GET', $wporg_url );
			// Must not be hosted on wp.org
			if ( 20 !== absint( substr( $response->status_code, 0, 2 ) ) ) {
				unset( $items[ $i ] );
				continue;
			}
			$data = json_decode( $response->body, true );
			// No minor or patch versions to access
			if ( empty( $data['versions'] ) ) {
				unset( $items[ $i ] );
				continue;
			}
			$update_version = false;
			$update_package = false;
			foreach ( $data['versions'] as $version => $download_link ) {
				$update_type = Utils\get_named_sem_ver( $version, $item['version'] );
				// Compared version must be older
				if ( ! $update_type ) {
					continue;
				}
				// Only permit 'patch' for 'patch'
				if ( 'patch' === $type && 'patch' !== $update_type ) {
					continue;
				}
				// Permit 'minor' or 'patch' for 'minor' phpcs:ignore Squiz.PHP.CommentedOutCode.Found -- False positive.
				if ( 'minor' === $type && ! in_array( $update_type, array( 'minor', 'patch' ), true ) ) {
					continue;
				}
				if ( $update_version && ! Comparator::greaterThan( $version, $update_version ) ) {
					continue;
				}
				$update_version = $version;
				$update_package = $download_link;
			}
			// If there's not a matching version, bail on updates
			if ( ! $update_version ) {
				unset( $items[ $i ] );
				continue;
			}
			$items[ $i ]['update_version'] = $update_version;
			$items[ $i ]['update_package'] = $update_package;
		}
		return $items;
	}
private function get_minor_or_patch_updates ( $ items , $ type ) { foreach ( $ items as $ i => $ item ) { $ wporg_url = sprintf ( 'https://api.wordpress.org/plugins/info/1.0/%s.json' , $ item [ 'name' ] ) ; $ response = Utils \ http_request ( 'GET' , $ wporg_url ) ; // Must not be hosted on wp.org if ( 20 !== absint ( substr ( $ response -> status_code , 0 , 2 ) ) ) { unset ( $ items [ $ i ] ) ; continue ; } $ data = json_decode ( $ response -> body , true ) ; // No minor or patch versions to access if ( empty ( $ data [ 'versions' ] ) ) { unset ( $ items [ $ i ] ) ; continue ; } $ update_version = false ; $ update_package = false ; foreach ( $ data [ 'versions' ] as $ version => $ download_link ) { $ update_type = Utils \ get_named_sem_ver ( $ version , $ item [ 'version' ] ) ; // Compared version must be older if ( ! $ update_type ) { continue ; } // Only permit 'patch' for 'patch' if ( 'patch' === $ type && 'patch' !== $ update_type ) { continue ; } // Permit 'minor' or 'patch' for 'minor' phpcs:ignore Squiz.PHP.CommentedOutCode.Found -- False positive. if ( 'minor' === $ type && ! in_array ( $ update_type , array ( 'minor' , 'patch' ) , true ) ) { continue ; } if ( $ update_version && ! Comparator :: greaterThan ( $ version , $ update_version ) ) { continue ; } $ update_version = $ version ; $ update_package = $ download_link ; } // If there's not a matching version, bail on updates if ( ! $ update_version ) { unset ( $ items [ $ i ] ) ; continue ; } $ items [ $ i ] [ 'update_version' ] = $ update_version ; $ items [ $ i ] [ 'update_package' ] = $ update_package ; } return $ items ; }
Get the minor or patch version for plugins with available updates

@param array  $items Plugins with updates.
@param string $type  Either 'minor' or 'patch'
@return array
Get the minor or patch version for plugins with available updates