1<?php
2
3
4namespace ComboStrap;
5
6
7class Boolean
8{
9
10    public static function toBoolean($value)
11    {
12        if ($value === null) return null;
13        return filter_var($value, FILTER_VALIDATE_BOOLEAN);
14    }
15
16    public static function toString(?bool $value): ?string
17    {
18        if ($value === null) {
19            return null;
20        }
21        if ($value) {
22            return "true";
23        } else {
24            return "false";
25        }
26    }
27}
28