Skip to content

Commit

Permalink
Simplify fetching of experimental input
Browse files Browse the repository at this point in the history
  • Loading branch information
ernilambar committed Feb 18, 2025
1 parent 4d1c189 commit c25eb3b
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions includes/Admin/Admin_AJAX.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,7 @@ public function set_up_environment() {
$checks = is_null( $checks ) ? array() : $checks;
$plugin = filter_input( INPUT_POST, 'plugin', FILTER_SANITIZE_FULL_SPECIAL_CHARS );

$include_experimental = filter_input( INPUT_POST, 'include-experimental', FILTER_VALIDATE_INT );
$include_experimental = ( 1 === absint( $include_experimental ) );
$include_experimental = 1 === filter_input( INPUT_POST, 'include-experimental', FILTER_VALIDATE_INT );

Check warning on line 115 in includes/Admin/Admin_AJAX.php

View check run for this annotation

Codecov / codecov/patch

includes/Admin/Admin_AJAX.php#L115

Added line #L115 was not covered by tests

try {
$runner->set_experimental_flag( $include_experimental );

Check warning on line 118 in includes/Admin/Admin_AJAX.php

View check run for this annotation

Codecov / codecov/patch

includes/Admin/Admin_AJAX.php#L118

Added line #L118 was not covered by tests
Expand Down Expand Up @@ -192,8 +191,7 @@ public function get_checks_to_run() {
$checks = filter_input( INPUT_POST, 'checks', FILTER_DEFAULT, FILTER_FORCE_ARRAY );
$checks = is_null( $checks ) ? array() : $checks;
$plugin = filter_input( INPUT_POST, 'plugin', FILTER_SANITIZE_FULL_SPECIAL_CHARS );
$include_experimental = filter_input( INPUT_POST, 'include-experimental', FILTER_VALIDATE_INT );
$include_experimental = ( 1 === absint( $include_experimental ) );
$include_experimental = 1 === filter_input( INPUT_POST, 'include-experimental', FILTER_VALIDATE_INT );
$runner = Plugin_Request_Utility::get_runner();

Check warning on line 195 in includes/Admin/Admin_AJAX.php

View check run for this annotation

Codecov / codecov/patch

includes/Admin/Admin_AJAX.php#L189-L195

Added lines #L189 - L195 were not covered by tests

if ( is_null( $runner ) ) {
Expand Down Expand Up @@ -262,8 +260,7 @@ public function run_checks() {
$checks = is_null( $checks ) ? array() : $checks;
$plugin = filter_input( INPUT_POST, 'plugin', FILTER_SANITIZE_FULL_SPECIAL_CHARS );

$include_experimental = filter_input( INPUT_POST, 'include-experimental', FILTER_VALIDATE_INT );
$include_experimental = ( 1 === absint( $include_experimental ) );
$include_experimental = 1 === filter_input( INPUT_POST, 'include-experimental', FILTER_VALIDATE_INT );

Check warning on line 263 in includes/Admin/Admin_AJAX.php

View check run for this annotation

Codecov / codecov/patch

includes/Admin/Admin_AJAX.php#L263

Added line #L263 was not covered by tests

try {
$runner->set_experimental_flag( $include_experimental );

Check warning on line 266 in includes/Admin/Admin_AJAX.php

View check run for this annotation

Codecov / codecov/patch

includes/Admin/Admin_AJAX.php#L266

Added line #L266 was not covered by tests
Expand Down

0 comments on commit c25eb3b

Please sign in to comment.