Total Complexity | 5 |
Total Lines | 46 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
12 | class MathUtils |
||
13 | { |
||
14 | /** |
||
15 | * Retorna el número de bytes que son necesarios para almacenar un número que |
||
16 | * vaya entre $min y $max, considerando si hay o no signo. |
||
17 | * |
||
18 | * Téngase en cuenta que min y unsigned son casi excluyentes, pero que unsigned |
||
19 | * sí que afecta al tamaño máximo positivo. |
||
20 | * |
||
21 | * Esta función pretende determinar el tipo de entero necesario. Las |
||
22 | * inconsistencias (que no son tales), las tendrá que contemplar quién lo invoque. |
||
23 | * |
||
24 | * @author Rafael San José Tovar <[email protected]> |
||
25 | * |
||
26 | * @param int $max |
||
27 | * @param int $min |
||
28 | * @param bool $unsigned |
||
29 | * |
||
30 | * @return int |
||
31 | */ |
||
32 | public static function howManyBytes(int $max, int $min = 0, bool $unsigned = Schema::DEFAULT_INTEGER_UNSIGNED): int |
||
60 |