Total Complexity | 4 |
Total Lines | 43 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php declare(strict_types=1); |
||
9 | class MemoryUsage extends AbstractReportable |
||
10 | { |
||
11 | 8 | public function __construct() |
|
12 | { |
||
13 | 8 | parent::__construct(); |
|
14 | 8 | $this->setBindings( |
|
15 | 8 | MemoryUsageReport::class, |
|
16 | 8 | MemoryUsageReportFormatter::class |
|
17 | ); |
||
18 | 8 | } |
|
19 | |||
20 | /** |
||
21 | * @param bool $real |
||
22 | * @param null|string $unit |
||
23 | * @param int|null $decimals |
||
24 | * @return string |
||
25 | */ |
||
26 | 2 | public static function get(bool $real = false, ?string $unit = null, ?int $decimals = null): string |
|
27 | { |
||
28 | return |
||
29 | 2 | Pretty::bytes(memory_get_usage($real), $unit, $decimals); |
|
30 | } |
||
31 | |||
32 | /** |
||
33 | * @param bool $real |
||
34 | * @param null|string $unit |
||
35 | * @param int|null $decimals |
||
36 | * @return string |
||
37 | */ |
||
38 | 2 | public static function getPeak(bool $real = false, ?string $unit = null, ?int $decimals = null): string |
|
42 | } |
||
43 | |||
44 | /** |
||
45 | * @return MemoryUsageReport |
||
46 | */ |
||
47 | 4 | public static function reportStatic(): MemoryUsageReport |
|
54 |