Failed Conditions
Pull Request — develop (#102)
by
unknown
07:37
created

includes/updates/update-3.3.0.php (2 issues)

Labels
Severity
1
<?php
2
/**
3
 * Update 3.3.0
4
 *
5
 * @author    Pronamic <[email protected]>
6
 * @copyright 2005-2019 Pronamic
7
 * @license   GPL-3.0-or-later
8
 * @package   Pronamic\WordPress\Pay
9
 */
10
11
/**
12
 * Execute changes made in Pronamic Pay 3.3.0
13
 *
14
 * @link https://github.com/WordPress/WordPress/blob/3.5.1/wp-admin/includes/upgrade.php#L413
15
 * @since 3.3.0
16
 */
17
18
$license_md5 = get_option( 'pronamic_pay_license_key' );
19
20
$url = add_query_arg( 'license', $license_md5, 'http://api.pronamic.eu/licenses/convert-md5/1.0/' );
21
22
$result = wp_remote_get( $url );
23
24
if ( 200 === wp_remote_retrieve_response_code( $result ) ) {
0 ignored issues
show
It seems like $result can also be of type WP_Error; however, parameter $response of wp_remote_retrieve_response_code() does only seem to accept array, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

24
if ( 200 === wp_remote_retrieve_response_code( /** @scrutinizer ignore-type */ $result ) ) {
Loading history...
25
	$body = wp_remote_retrieve_body( $result );
0 ignored issues
show
It seems like $result can also be of type WP_Error; however, parameter $response of wp_remote_retrieve_body() does only seem to accept array, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

25
	$body = wp_remote_retrieve_body( /** @scrutinizer ignore-type */ $result );
Loading history...
26
27
	if ( 32 === strlen( $body ) ) {
28
		update_option( 'pronamic_pay_license_key', $body );
29
	}
30
}
31