Skip to content

Commit

Permalink
Merge pull request #215 from Yoast/JRF/cs-no-long-closures
Browse files Browse the repository at this point in the history
CS/QA: don't use long closures
  • Loading branch information
jrfnl authored Dec 16, 2023
2 parents ad33bb5 + b134fb9 commit 8783577
Showing 1 changed file with 19 additions and 13 deletions.
32 changes: 19 additions & 13 deletions src/admin-page.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,19 +90,25 @@ public function show_admin_page() {
echo '<div id="yoast_masonry">';
$this->masonry_script();

\array_map(
static function( $block ) {
$block_output = $block();
if ( $block_output === '' ) {
return;
}
echo '<div class="wpseo_test_block">';
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo $block_output;
echo '</div>';
},
$this->admin_page_blocks
);
\array_map( [ $this, 'display_block_output' ], $this->admin_page_blocks );
echo '</div>';
}

/**
* 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 '<div class="wpseo_test_block">';
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo $block_output;
echo '</div>';
}

Expand Down

0 comments on commit 8783577

Please sign in to comment.