Use FILTER_VALIDATE_BOOLEAN to convert boolean

This commit is contained in:
moon 2022-04-15 06:56:54 -07:00
parent a9f2322d8c
commit f0e8ad9c86
1 changed files with 1 additions and 7 deletions

View File

@ -61,12 +61,6 @@ class WCA_Test_Helper_Rest_Api_Filters {
$dot_notation = $request->get_param('dot_notation'); $dot_notation = $request->get_param('dot_notation');
$replacement = $request->get_param('replacement'); $replacement = $request->get_param('replacement');
if ($replacement === 'false' ) {
$replacement = false;
} else if ($replacement === 'true' ) {
$replacement = true;
}
self::update( self::update(
function ( $filters ) use ( function ( $filters ) use (
$endpoint, $endpoint,
@ -76,7 +70,7 @@ class WCA_Test_Helper_Rest_Api_Filters {
$filters[] = array( $filters[] = array(
'endpoint' => $endpoint, 'endpoint' => $endpoint,
'dot_notation' => $dot_notation, 'dot_notation' => $dot_notation,
'replacement' => $replacement, 'replacement' => filter_var( $replacement, FILTER_VALIDATE_BOOLEAN ),
'enabled' => true, 'enabled' => true,
); );
return $filters; return $filters;