Skip to content

Commit f24ec90

Browse files
committed
CS: PHPCBF auto-fixes.
1 parent 2829b7a commit f24ec90

File tree

5 files changed

+28
-29
lines changed

5 files changed

+28
-29
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"10up/wp-compat-validation-tool": "dev-trunk"
1818
},
1919
"require-dev": {
20-
"10up/phpcs-composer": "dev-master"
20+
"10up/phpcs-composer": "dev-trunk"
2121
},
2222
"scripts": {
2323
"lint": "./vendor/bin/phpcs",

includes/block-assets.php

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ function register_block_assets() {
1919
wp_register_style(
2020
'maps-block-apple-settings',
2121
trailingslashit( MAPS_BLOCK_APPLE_URL ) . 'assets/css/admin-maps-block-apple-settings.css',
22-
[],
22+
array(),
2323
MAPS_BLOCK_APPLE_VERSION
2424
);
2525

2626
/**
2727
* Mapkit Library
2828
*/
29-
wp_register_script( 'apple-mapkit-js', 'https://cdn.apple-mapkit.com/mk/5.x.x/mapkit.js', [], 5, false );
29+
wp_register_script( 'apple-mapkit-js', 'https://cdn.apple-mapkit.com/mk/5.x.x/mapkit.js', array(), 5, false );
3030

3131
/**
3232
* Admin Settings Script
@@ -36,7 +36,7 @@ function register_block_assets() {
3636
wp_register_script(
3737
'maps-block-apple-settings',
3838
MAPS_BLOCK_APPLE_URL . "build/$settings_file_name.js",
39-
array_merge( $settings_dependencies['dependencies'], [ 'apple-mapkit-js' ] ),
39+
array_merge( $settings_dependencies['dependencies'], array( 'apple-mapkit-js' ) ),
4040
$settings_dependencies['version'],
4141
true
4242
);
@@ -49,16 +49,16 @@ function register_block_assets() {
4949
wp_register_script(
5050
'maps-block-apple-block',
5151
MAPS_BLOCK_APPLE_URL . "build/$block_file_name.js",
52-
array_merge( $block_dependencies['dependencies'], [ 'apple-mapkit-js' ] ),
52+
array_merge( $block_dependencies['dependencies'], array( 'apple-mapkit-js' ) ),
5353
$block_dependencies['version'],
5454
false
5555
);
5656
wp_localize_script(
5757
'maps-block-apple-block',
5858
'_mbaData',
59-
[
59+
array(
6060
'settingsURL' => admin_url( 'options-general.php?page=block-for-apple-maps' ),
61-
]
61+
)
6262
);
6363

6464
/**
@@ -69,13 +69,12 @@ function register_block_assets() {
6969
wp_register_script(
7070
'maps-block-apple-frontend',
7171
MAPS_BLOCK_APPLE_URL . "build/$fe_file_name.js",
72-
array_merge( $frontend_dependencies['dependencies'], [ 'apple-mapkit-js' ] ),
72+
array_merge( $frontend_dependencies['dependencies'], array( 'apple-mapkit-js' ) ),
7373
$frontend_dependencies['version'],
7474
false
7575
);
7676

7777
register_block_type( MAPS_BLOCK_APPLE_PATH );
78-
7978
}
8079

8180
add_action( 'enqueue_block_assets', __NAMESPACE__ . '\load_apple_map_script_in_iframe' );

includes/rest-routes.php

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77

88
namespace tenup\Maps_Block_Apple;
99

10-
use \WP_Error as WP_Error;
11-
use \WP_REST_Response as WP_REST_Response;
10+
use WP_Error;
11+
use WP_REST_Response;
1212
use function tenup\Maps_Block_Apple\Settings\get_setting;
1313

1414
define( 'MAPS_BLOCK_APPLE_VERSION_REST_NAMESPACE', 'MapsBlockApple/v1' );
@@ -23,11 +23,11 @@ function add_endpoints() {
2323
register_rest_route(
2424
MAPS_BLOCK_APPLE_VERSION_REST_NAMESPACE,
2525
'/GetJWT',
26-
[
26+
array(
2727
'methods' => 'GET',
2828
'callback' => __NAMESPACE__ . '\get_jwt',
2929
'permission_callback' => '__return_true',
30-
]
30+
)
3131
);
3232
}
3333

@@ -55,39 +55,39 @@ function get_jwt() {
5555
$team_id = get_setting( 'team_id' );
5656

5757
if ( ! isset( $private_key ) || '' === $private_key ) {
58-
return new WP_Error( 'NoKey', 'Missing Private Key', [ 'status' => 401 ] );
58+
return new WP_Error( 'NoKey', 'Missing Private Key', array( 'status' => 401 ) );
5959
}
6060
if ( ! isset( $key_id ) || '' === $key_id ) {
61-
return new WP_Error( 'NoKey', 'Missing Key ID', [ 'status' => 401 ] );
61+
return new WP_Error( 'NoKey', 'Missing Key ID', array( 'status' => 401 ) );
6262
}
6363
if ( ! isset( $team_id ) || '' === $team_id ) {
64-
return new WP_Error( 'NoKey', 'Missing Team ID', [ 'status' => 401 ] );
64+
return new WP_Error( 'NoKey', 'Missing Team ID', array( 'status' => 401 ) );
6565
}
6666
if ( 10 !== strlen( $key_id ) ) {
67-
return new WP_Error( 'InvalidKey', 'Invalid Key ID', [ 'status' => 401 ] );
67+
return new WP_Error( 'InvalidKey', 'Invalid Key ID', array( 'status' => 401 ) );
6868
}
6969
if ( 10 !== strlen( $team_id ) ) {
70-
return new WP_Error( 'InvalidKey', 'Invalid Team ID', [ 'status' => 401 ] );
70+
return new WP_Error( 'InvalidKey', 'Invalid Team ID', array( 'status' => 401 ) );
7171
}
7272
if (
7373
0 !== strpos( $private_key, '-----BEGIN PRIVATE KEY-----' )
7474
&& ! strpos( $private_key, '-----END PRIVATE KEY-----' )
7575
) {
76-
return new WP_Error( 'InvalidKey', 'Invalid Private Key', [ 'status' => 401 ] );
76+
return new WP_Error( 'InvalidKey', 'Invalid Private Key', array( 'status' => 401 ) );
7777
}
7878

79-
$header = [
79+
$header = array(
8080
'alg' => 'ES256',
8181
'typ' => 'JWT',
8282
'kid' => $key_id,
83-
];
83+
);
8484

85-
$body = [
85+
$body = array(
8686
'iss' => $team_id,
8787
'iat' => time(),
8888
'exp' => time() + 30,
8989
'origin' => get_fqdn_from_url( get_site_url() ),
90-
];
90+
);
9191

9292
// exlude the origin restriction from the JWT for local environemts
9393
// this is to allow tools like wp-env or browsersync to work since the url
@@ -100,11 +100,11 @@ function get_jwt() {
100100

101101
$key = openssl_pkey_get_private( $private_key );
102102
if ( ! $key ) {
103-
return new WP_Error( 'InvalidKey', 'Invalid Private Key', [ 'status' => 401 ] );
103+
return new WP_Error( 'InvalidKey', 'Invalid Private Key', array( 'status' => 401 ) );
104104
}
105105

106106
if ( ! openssl_sign( $payload, $signature, $key, OPENSSL_ALGO_SHA256 ) ) {
107-
return new WP_Error( 'SignError', 'Signing Failed', [ 'status' => 500 ] );
107+
return new WP_Error( 'SignError', 'Signing Failed', array( 'status' => 500 ) );
108108
}
109109

110110
$response = $payload . '.' . encode( $signature );

includes/settings.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ function setup() {
3131
* @return mixed
3232
*/
3333
function get_setting( $setting ) {
34-
$settings = get_option( 'maps_block_apple', [] );
34+
$settings = get_option( 'maps_block_apple', array() );
3535
return isset( $settings[ $setting ] ) ? $settings[ $setting ] : '';
3636
}
3737

@@ -61,7 +61,7 @@ function register_settings() {
6161
),
6262
),
6363
),
64-
'default' => [],
64+
'default' => array(),
6565
'sanitize_callback' => __NAMESPACE__ . '\sanitize_settings',
6666
)
6767
);
@@ -294,7 +294,7 @@ function render_credential_status() {
294294
* @since 1.0
295295
*/
296296
function sanitize_settings( $settings ) {
297-
$new_settings = [];
297+
$new_settings = array();
298298
if ( isset( $settings['private_key'] ) ) {
299299
$new_settings['private_key'] = trim( $settings['private_key'] );
300300
}

maps-block-apple.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
// Useful global constants.
2121
define( 'MAPS_BLOCK_APPLE_VERSION', '1.1.5' );
2222
define( 'MAPS_BLOCK_APPLE_URL', plugin_dir_url( __FILE__ ) );
23-
define( 'MAPS_BLOCK_APPLE_PATH', dirname( __FILE__ ) . '/' );
23+
define( 'MAPS_BLOCK_APPLE_PATH', __DIR__ . '/' );
2424
define( 'MAPS_BLOCK_APPLE_INC', MAPS_BLOCK_APPLE_PATH . 'includes/' );
2525
define( 'MAPS_BLOCK_APPLE_BASENAME', plugin_basename( __FILE__ ) );
2626

0 commit comments

Comments
 (0)