Skip to content

Commit 167b3b6

Browse files
committed
more linting
1 parent a327101 commit 167b3b6

2 files changed

Lines changed: 24 additions & 6 deletions

File tree

includes/HelpCenter.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -197,16 +197,16 @@ public function assets() {
197197
self::$handle,
198198
'var nfdHelpCenter =' . wp_json_encode(
199199
array(
200-
'restUrl' => \get_home_url() . '/index.php?rest_route=',
201-
'resourceLink' => Brands::get_resource_link_for_brand( NFD_HELPCENTER_PLUGIN_BRAND ),
202-
'brand' => NFD_HELPCENTER_PLUGIN_BRAND,
203-
'brandConfig' => $brand_data,
200+
'restUrl' => \get_home_url() . '/index.php?rest_route=',
201+
'resourceLink' => Brands::get_resource_link_for_brand( NFD_HELPCENTER_PLUGIN_BRAND ),
202+
'brand' => NFD_HELPCENTER_PLUGIN_BRAND,
203+
'brandConfig' => $brand_data,
204204
/* translators: 1: account name, 2: phone link, 3: chat link */
205-
'supportMessageTemplate' => __( 'If you need help with your %1$s account, give us a call at %2$s or %3$s with one of our support agents — we\'re here for you!', 'wp-module-help-center' ),
205+
'supportMessageTemplate' => __( 'If you need help with your %1$s account, give us a call at %2$s or %3$s with one of our support agents — we\'re here for you!', 'wp-module-help-center' ),
206206
/* translators: 1: account name, 2: chat link */
207207
'supportMessageTemplateNoPhone' => __( 'If you need help with your %1$s account, %2$s with one of our support agents — we\'re here for you!', 'wp-module-help-center' ),
208208
/* translators: 1: phone link, 2: chat link */
209-
'noResultsSupportTemplate' => __( 'Call at %1$s or %2$s with one of our support agents — we will assist you as soon as possible.', 'wp-module-help-center' ),
209+
'noResultsSupportTemplate' => __( 'Call at %1$s or %2$s with one of our support agents — we will assist you as soon as possible.', 'wp-module-help-center' ),
210210
/* translators: 1: chat link */
211211
'noResultsSupportTemplateNoPhone' => __( 'Or %1$s with one of our support agents — we will assist you as soon as possible.', 'wp-module-help-center' ),
212212
)
@@ -215,6 +215,7 @@ public function assets() {
215215
);
216216

217217
/* Hide the helpcenter on onboarding flow */
218+
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Reading page query param for display logic, not form submission.
218219
\wp_localize_script( self::$handle, 'newfoldHelpCenter', array( 'closeOnLoad' => ( isset( $_GET['page'] ) && 'nfd-onboarding' === sanitize_text_field( wp_unslash( $_GET['page'] ) ) ) ) );
219220

220221
/* Remove values on log out */

tests/wpunit/DataBrandsWPUnitTest.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ public function test_get_data_for_brand_hostgator_undefined_region_falls_back_to
105105
* @return void
106106
*/
107107
public function test_get_data_for_brand_unknown_brand_falls_back_to_bluehost() {
108+
// phpcs:ignore WordPress.WP.CapitalPDangit.MisspelledInText -- Intentionally lowercase brand key for test.
108109
$data = Brands::get_data_for_brand( 'wordpress' );
109110
$this->assertSame( 'bluehost', $data['brand'] );
110111
$this->assertStringContainsString( 'bluehost', $data['helpURL'] );
@@ -206,6 +207,7 @@ public function test_get_resource_link_for_brand_bare_hostgator_returns_us_url()
206207
* @return void
207208
*/
208209
public function test_get_data_for_brand_returns_has_phone_key() {
210+
// phpcs:ignore WordPress.WP.CapitalPDangit.MisspelledInText -- Intentionally lowercase brand key for test.
209211
$brands_to_check = array( 'bluehost', 'hostgator-us', 'hostgator-xy', 'hostgator', 'wordpress' );
210212
foreach ( $brands_to_check as $brand ) {
211213
$data = Brands::get_data_for_brand( $brand );
@@ -229,12 +231,27 @@ public function test_set_current_brand_accepts_container_and_defines_constant()
229231
$plugin->region = '';
230232

231233
$container = new class( $plugin ) {
234+
/**
235+
* Plugin object with brand and region.
236+
*
237+
* @var \stdClass
238+
*/
232239
private $plugin;
233240

241+
/**
242+
* Constructor.
243+
*
244+
* @param \stdClass $plugin Plugin object.
245+
*/
234246
public function __construct( $plugin ) {
235247
$this->plugin = $plugin;
236248
}
237249

250+
/**
251+
* Returns the plugin object.
252+
*
253+
* @return \stdClass
254+
*/
238255
public function plugin() {
239256
return $this->plugin;
240257
}

0 commit comments

Comments
 (0)