Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CS/QA: don't use long closures #215

Merged
merged 1 commit into from
Dec 16, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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