Code Coverage  | 
      ||||||||||
Lines  | 
       Functions and Methods  | 
       Classes and Traits  | 
      ||||||||
| Total |         | 
       100.00%  | 
       9 / 9  | 
               | 
       100.00%  | 
       1 / 1  | 
       CRAP |         | 
       100.00%  | 
       1 / 1  | 
      
| HttpFilterableTrait |         | 
       100.00%  | 
       9 / 9  | 
               | 
       100.00%  | 
       1 / 1  | 
       6 |         | 
       100.00%  | 
       1 / 1  | 
      
| filter |         | 
       100.00%  | 
       9 / 9  | 
               | 
       100.00%  | 
       1 / 1  | 
       6 | |||
| 1 | <?php | 
| 2 | /** | 
| 3 | * Pop PHP Framework (https://www.popphp.org/) | 
| 4 | * | 
| 5 | * @link https://github.com/popphp/popphp-framework | 
| 6 | * @author Nick Sagona, III <dev@noladev.com> | 
| 7 | * @copyright Copyright (c) 2009-2025 NOLA Interactive, LLC. | 
| 8 | * @license https://www.popphp.org/license New BSD License | 
| 9 | */ | 
| 10 | |
| 11 | /** | 
| 12 | * @namespace | 
| 13 | */ | 
| 14 | namespace Pop\Http; | 
| 15 | |
| 16 | use Pop\Filter\FilterableTrait; | 
| 17 | |
| 18 | /** | 
| 19 | * HTTP filterable trait | 
| 20 | * | 
| 21 | * @category Pop | 
| 22 | * @package Pop\Http | 
| 23 | * @author Nick Sagona, III <dev@noladev.com> | 
| 24 | * @copyright Copyright (c) 2009-2025 NOLA Interactive, LLC. | 
| 25 | * @license https://www.popphp.org/license New BSD License | 
| 26 | * @version 5.3.2 | 
| 27 | */ | 
| 28 | trait HttpFilterableTrait | 
| 29 | { | 
| 30 | |
| 31 | use FilterableTrait; | 
| 32 | |
| 33 | /** | 
| 34 | * Filter values | 
| 35 | * | 
| 36 | * @param mixed $values | 
| 37 | * @return mixed | 
| 38 | */ | 
| 39 | public function filter(mixed $values): mixed | 
| 40 | { | 
| 41 | $disabledFunctions = array_filter(array_map('trim', explode(',', ini_get('disable_functions')))); | 
| 42 | |
| 43 | foreach ($this->filters as $filter) { | 
| 44 | if (is_array($values)) { | 
| 45 | foreach ($values as $key => $value) { | 
| 46 | if (!in_array($value, $disabledFunctions)) { | 
| 47 | $values[$key] = $filter->filter($value, $key); | 
| 48 | } | 
| 49 | } | 
| 50 | } else { | 
| 51 | if (!in_array($values, $disabledFunctions)) { | 
| 52 | $values = $filter->filter($values); | 
| 53 | } | 
| 54 | } | 
| 55 | } | 
| 56 | |
| 57 | return $values; | 
| 58 | } | 
| 59 | |
| 60 | } |