From b134fb926c9d025120961127cdef37b2a78295bf Mon Sep 17 00:00:00 2001 From: jrfnl Date: Fri, 22 Sep 2023 09:08:32 +0200 Subject: [PATCH] CS/QA: don't use long closures ... use a named function instead. --- src/admin-page.php | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/src/admin-page.php b/src/admin-page.php index 8087d53..7df304f 100644 --- a/src/admin-page.php +++ b/src/admin-page.php @@ -90,19 +90,25 @@ public function show_admin_page() { echo '
'; $this->masonry_script(); - \array_map( - static function( $block ) { - $block_output = $block(); - if ( $block_output === '' ) { - return; - } - echo '
'; - // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped - echo $block_output; - echo '
'; - }, - $this->admin_page_blocks - ); + \array_map( [ $this, 'display_block_output' ], $this->admin_page_blocks ); + echo '
'; + } + + /** + * Display an admin page block. + * + * @param callable $block Admin page block. + * + * @return void + */ + private function display_block_output( $block ) { + $block_output = $block(); + if ( $block_output === '' ) { + return; + } + echo '
'; + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped + echo $block_output; echo '
'; }