Skip to content

Commit 55bccb0

Browse files
committed
Apply some PHPCS fixes
1 parent 122b865 commit 55bccb0

File tree

2 files changed

+21
-54
lines changed

2 files changed

+21
-54
lines changed

class-wp-bootstrap-navwalker.php

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -264,9 +264,9 @@ public function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0
264264
* If the .sr-only class was set apply to the nav items text only.
265265
*/
266266
if ( in_array( 'sr-only', $linkmod_classes, true ) ) {
267-
$title = self::wrap_for_screen_reader( $title );
267+
$title = self::wrap_for_screen_reader( $title );
268268
$keys_to_unset = array_keys( $linkmod_classes, 'sr-only' );
269-
foreach($keys_to_unset as $k) {
269+
foreach ( $keys_to_unset as $k ) {
270270
unset( $linkmod_classes[ $k ] );
271271
}
272272
}
@@ -279,12 +279,12 @@ public function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0
279279
* correct element depending on the type of link or link mod.
280280
*/
281281
if ( '' !== $linkmod_type ) {
282-
// is linkmod, output the required element opener.
283-
$item_output .= self::linkmod_element_close( $linkmod_type, $attributes );
284-
} else {
285-
// With no link mod type set this must be a standard <a> tag.
286-
$item_output .= '</a>';
287-
}
282+
// is linkmod, output the required element opener.
283+
$item_output .= self::linkmod_element_close( $linkmod_type, $attributes );
284+
} else {
285+
// With no link mod type set this must be a standard <a> tag.
286+
$item_output .= '</a>';
287+
}
288288

289289
$item_output .= $args->after;
290290
/**
@@ -391,20 +391,20 @@ public static function fallback( $args ) {
391391
*
392392
* @since 4.0.0
393393
*
394-
* @param array $classes an array of classes currently assigned to the item.
395-
* @param array $link_classes an array to hold linkmod classes.
396-
* @param array $icon_classes an array to hold icon classes.
397-
* @param integer $depth an integer holding current depth level.
394+
* @param array $classes an array of classes currently assigned to the item.
395+
* @param array $linkmod_classes an array to hold linkmod classes.
396+
* @param array $icon_classes an array to hold icon classes.
397+
* @param integer $depth an integer holding current depth level.
398398
*
399-
* @return array $classes a maybe modified array of classnames.
399+
* @return array $classes a maybe modified array of classnames.
400400
*/
401401
private function seporate_linkmods_and_icons_from_classes( $classes, &$linkmod_classes, &$icon_classes, $depth ) {
402402
// Loop through $classes array to find linkmod or icon classes.
403403
foreach ( $classes as $key => $class ) {
404404
// If any special classes are found, store the class in it's
405405
// holder array and and unset the item from $classes.
406406
if ( preg_match( '/disabled|sr-only/', $class ) ) {
407-
// Test for .disabled or .sr-only
407+
// Test for .disabled or .sr-only classes.
408408
$linkmod_classes[] = $class;
409409
unset( $classes[ $key ] );
410410
} elseif ( preg_match( '/dropdown-header|dropdown-divider/', $class ) && $depth > 0 ) {
@@ -460,17 +460,18 @@ private function get_linkmod_type( $linkmod_classes = array() ) {
460460
*
461461
* @since 4.0.0
462462
*
463-
* @param array $atts array of atts for the current link in nav item.
463+
* @param array $atts array of atts for the current link in nav item.
464+
* @param array $linkmod_classes an array of classes that modify link or nav item behaviors or displays.
464465
*
465-
* @return array maybe updated array of attributes for item.
466+
* @return array maybe updated array of attributes for item.
466467
*/
467468
private function update_atts_for_linkmod_type( $atts = array(), $linkmod_classes = array() ) {
468469
if ( ! empty( $linkmod_classes ) ) {
469470
foreach ( $linkmod_classes as $link_class ) {
470471
if ( ! empty( $link_class ) ) {
471472
// update $atts with a space and the extra classname...
472473
// so long as it's not a sr-only class.
473-
if( 'sr-only' !== $link_class ) {
474+
if ( 'sr-only' !== $link_class ) {
474475
$atts['class'] .= ' ' . esc_attr( $link_class );
475476
}
476477
// check for special class types we need additional handling for.
@@ -497,7 +498,7 @@ private function update_atts_for_linkmod_type( $atts = array(), $linkmod_classes
497498
* @param string $text the string of text to be wrapped in a screen reader class.
498499
* @return string the string wrapped in a span with the class.
499500
*/
500-
private function wrap_for_screen_reader( $text = '') {
501+
private function wrap_for_screen_reader( $text = '' ) {
501502
if ( $text ){
502503
$text = '<span class="sr-only">' . $text . '</span>';
503504
}
@@ -515,7 +516,7 @@ private function wrap_for_screen_reader( $text = '') {
515516
* @return string a string with the openign tag for the element with attribibutes added.
516517
*/
517518
private function linkmod_element_open( $linkmod_type, $attributes = '' ) {
518-
$output = '';
519+
$output = '';
519520
if ( 'dropdown-header' === $linkmod_type ) {
520521
// For a header use a span with the .h6 class instead of a real
521522
// header tag so that it doesn't confuse screen readers.
@@ -537,7 +538,7 @@ private function linkmod_element_open( $linkmod_type, $attributes = '' ) {
537538
* @return string a string with the closing tag for this linkmod type.
538539
*/
539540
private function linkmod_element_close( $linkmod_type ) {
540-
$output = '';
541+
$output = '';
541542
if ( 'dropdown-header' === $linkmod_type ) {
542543
// For a header use a span with the .h6 class instead of a real
543544
// header tag so that it doesn't confuse screen readers.

phpcs.xml

Lines changed: 0 additions & 34 deletions
This file was deleted.

0 commit comments

Comments
 (0)