style: auto-fix PHPCS violations via phpcbf

This commit is contained in:
peptiderepo
2026-06-16 15:26:16 +00:00
parent 08d7696444
commit b9158d7dca
45 changed files with 1018 additions and 658 deletions

View File

@@ -109,11 +109,11 @@ class PR_Core_Pubchem_Client {
return null;
}
return [
return array(
'formula' => $formula,
'weight' => $weight,
'cid' => $cid,
];
);
}
/**
@@ -130,14 +130,14 @@ class PR_Core_Pubchem_Client {
$body = $this->get_with_retry( $url );
if ( null === $body ) {
return [];
return array();
}
$data = json_decode( $body, true );
$synonyms = $data['InformationList']['Information'][0]['Synonym'] ?? [];
$synonyms = $data['InformationList']['Information'][0]['Synonym'] ?? array();
if ( ! is_array( $synonyms ) ) {
return [];
return array();
}
return array_slice( $synonyms, 0, self::MAX_SYNONYMS );
@@ -176,10 +176,13 @@ class PR_Core_Pubchem_Client {
*/
private function get_once( string $url ): ?string {
if ( function_exists( 'wp_remote_get' ) ) {
$response = wp_remote_get( $url, [
'timeout' => self::TIMEOUT,
'headers' => [ 'Accept' => 'application/json' ],
] );
$response = wp_remote_get(
$url,
array(
'timeout' => self::TIMEOUT,
'headers' => array( 'Accept' => 'application/json' ),
)
);
if ( is_wp_error( $response ) ) {
return null;
@@ -194,13 +197,15 @@ class PR_Core_Pubchem_Client {
}
// WP-CLI / plain PHP fallback.
$context = stream_context_create( [
'http' => [
'timeout' => self::TIMEOUT,
'header' => "Accept: application/json\r\n",
'method' => 'GET',
],
] );
$context = stream_context_create(
array(
'http' => array(
'timeout' => self::TIMEOUT,
'header' => "Accept: application/json\r\n",
'method' => 'GET',
),
)
);
$body = @file_get_contents( $url, false, $context );
return ( false === $body ) ? null : $body;