Skip to content
Closed
Show file tree
Hide file tree
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
3 changes: 2 additions & 1 deletion app/Http/Utils/Filters/Filter.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

use App\Http\Utils\Filters\IQueryApplyable;
use App\libs\Utils\PunnyCodeHelper;
use App\Utils\Helpers;
use Doctrine\ORM\QueryBuilder;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Validator;
Expand Down Expand Up @@ -504,7 +505,7 @@ private function convertValue($value, string $original_format)
return self::convertToDateTime($value, $strTimeZone);
break;
case self::Boolean:
return to_boolean($value) ? 1 : 0;
return Helpers::to_boolean($value) ? 1 : 0;
break;
case self::Int:
if (is_array($value)) {
Expand Down
6 changes: 4 additions & 2 deletions app/Http/Utils/Filters/FilterElement.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php namespace utils;
use App\Utils\Helpers;

/**
* Copyright 2015 OpenStack Foundation
* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -69,11 +71,11 @@ public function getBooleanValue(){
if(is_array($this->value)){
$res = [];
foreach ($this->value as $val){
$res[]= empty($val) ? '' : to_boolean($val);
$res[]= empty($val) ? '' : Helpers::to_boolean($val);
}
return $res;
}
return to_boolean($this->value);
return Helpers::to_boolean($this->value);
}

public static function mapValueSymbols(string $val):string{
Expand Down
15 changes: 4 additions & 11 deletions app/Utils/helpers.php → app/Utils/Helpers.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
<?php namespace App\Utils;
/*
* Copyright 2023 OpenStack Foundation
* Copyright 2025 OpenStack Foundation
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
Expand All @@ -12,15 +12,8 @@
* limitations under the License.
**/

if (!function_exists('to_boolean')) {

/**
* Convert to boolean
*
* @param $booleable
* @return boolean
*/
function to_boolean($booleable)
final class Helpers {
static function to_boolean($booleable)
{
return filter_var($booleable, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE);
}
Expand Down
Loading