Skip to content

Commit c2e3342

Browse files
Merge pull request #14 from TheDragonCode/2.x
2.x
2 parents 5c8bfec + b2fc1b5 commit c2e3342

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

src/Services/View.php

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,12 @@ protected function appendMs(array $data): array
5959
continue;
6060
}
6161

62-
$value = sprintf('%s ms - %s', $this->roundTime($value['time']), $this->roundRam($value['ram']));
62+
$time = $this->roundTime($value['time']);
63+
$ram = $this->roundRam($value['ram'] ?? null);
64+
65+
$value = ! empty($ram)
66+
? sprintf('%s ms - %s', $time, $ram)
67+
: sprintf('%s ms', $time);
6368
}
6469
}
6570

@@ -75,8 +80,12 @@ protected function roundTime(float $value): float
7580
return $value;
7681
}
7782

78-
protected function roundRam(float|int $bytes): string
83+
protected function roundRam(float|int|null $bytes): ?string
7984
{
80-
return $this->memory->format((int) $bytes);
85+
if ($bytes !== null) {
86+
return $this->memory->format((int) $bytes);
87+
}
88+
89+
return null;
8190
}
8291
}

src/Transformers/Stats.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ protected function calculate(array $data): array
4242
}
4343

4444
foreach ($data['total'] as $name => $value) {
45-
$this->put($items, 'total', $name, fn () => ['time' => $value[0], 'ram' => $value[1]]);
45+
$this->put($items, 'total', $name, fn () => ['time' => $value[0]]);
4646
}
4747

4848
return $items;

tests/TestCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ protected function benchmark(): Benchmark
1616

1717
protected function work(): void
1818
{
19-
usleep(50);
19+
usleep(10);
2020
}
2121
}

0 commit comments

Comments
 (0)