Issues (3)

src/Utility.php (1 issue)

Labels
Severity
1
<?php
2
3
declare(strict_types=1);
4
5
namespace GraphQL\Upload;
6
7
/**
8
 * @internal
9
 */
10
final class Utility
11
{
12 12
    public static function getPostMaxSize(): int
13
    {
14 12
        return self::fromIni('post_max_size');
15
    }
16
17 1
    public static function getUploadMaxFilesize(): int
18
    {
19 1
        return self::fromIni('upload_max_filesize');
20
    }
21
22 13
    private static function fromIni(string $key): int
23
    {
24 13
        return ini_parse_quantity(ini_get($key) ?: '0');
0 ignored issues
show
The function ini_parse_quantity was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

24
        return /** @scrutinizer ignore-call */ ini_parse_quantity(ini_get($key) ?: '0');
Loading history...
25
    }
26
27
    /**
28
     * @param int|numeric-string $value
29
     */
30 2
    public static function toMebibyte(string|int $value): string
31
    {
32 2
        return number_format($value / 1024 / 1024, 2, thousands_separator: "'") . ' MiB';
33
    }
34
}
35