array_splice possible fix
Publish PHP Package / docker (push) Successful in 6s
Details
Publish PHP Package / docker (push) Successful in 6s
Details
This commit is contained in:
parent
54cd3576d7
commit
058ab92420
|
@ -291,8 +291,10 @@ function _extract_lines_from_file(string $file_path) : array
|
||||||
|
|
||||||
function _show_bench(array $tasks, int $limit = 5)
|
function _show_bench(array $tasks, int $limit = 5)
|
||||||
{
|
{
|
||||||
$times = array();
|
if(!$tasks)
|
||||||
|
return;
|
||||||
|
|
||||||
|
$times = array();
|
||||||
foreach($tasks as $name => $task)
|
foreach($tasks as $name => $task)
|
||||||
{
|
{
|
||||||
if($task->hasRun())
|
if($task->hasRun())
|
||||||
|
@ -300,6 +302,7 @@ function _show_bench(array $tasks, int $limit = 5)
|
||||||
}
|
}
|
||||||
|
|
||||||
uasort($times, fn($a, $b) => $b <=> $a);
|
uasort($times, fn($a, $b) => $b <=> $a);
|
||||||
|
if(count($times) > $limit)
|
||||||
array_splice($times, $limit);
|
array_splice($times, $limit);
|
||||||
|
|
||||||
if(!$times)
|
if(!$times)
|
||||||
|
|
Loading…
Reference in New Issue