Skip to content

Commit 4d97b62

Browse files
Delete unused common.php functions (#2716)
A bit of spring cleaning to remove functions which have been rendered obsolete since my last pass through `common.php`.
1 parent c53db2f commit 4d97b62

File tree

2 files changed

+1
-86
lines changed

2 files changed

+1
-86
lines changed

app/cdash/include/common.php

Lines changed: 0 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -492,30 +492,6 @@ function date2day(string $date): string
492492
return is_numeric(substr($date, 4, 1)) ? substr($date, 6, 2) : substr($date, 8, 2);
493493
}
494494

495-
/**
496-
* Get hour from formatted time
497-
*/
498-
function time2hour(string $time): string
499-
{
500-
return substr($time, 0, 2);
501-
}
502-
503-
/**
504-
* Get minute from formatted time
505-
*/
506-
function time2minute(string $time): string
507-
{
508-
return is_numeric(substr($time, 2, 1)) ? substr($time, 2, 2) : substr($time, 3, 2);
509-
}
510-
511-
/**
512-
* Get second from formatted time
513-
*/
514-
function time2second(string $time): string
515-
{
516-
return is_numeric(substr($time, 2, 1)) ? substr($time, 4, 2) : substr($time, 6, 2);
517-
}
518-
519495
/** Get dates
520496
* today: the *starting* timestamp of the current dashboard
521497
* previousdate: the date in Y-m-d format of the previous dashboard
@@ -579,18 +555,6 @@ function make_cdash_url(string $url): string
579555
return $url;
580556
}
581557

582-
/**
583-
* Quote SQL interval specifier
584-
*/
585-
function qiv($iv)
586-
{
587-
if (config('database.default') == 'pgsql') {
588-
return "'$iv'";
589-
} else {
590-
return $iv;
591-
}
592-
}
593-
594558
/**
595559
* Quote SQL number
596560
*/
@@ -605,30 +569,6 @@ function qnum($num)
605569
}
606570
}
607571

608-
/**
609-
* Return the byte value with proper extension
610-
*/
611-
function getByteValueWithExtension($value, $base = 1024): string
612-
{
613-
$valueext = '';
614-
if ($value > $base) {
615-
$value /= $base;
616-
$value = $value;
617-
$valueext = 'K';
618-
}
619-
if ($value > $base) {
620-
$value /= $base;
621-
$value = $value;
622-
$valueext = 'M';
623-
}
624-
if ($value > $base) {
625-
$value /= $base;
626-
$value = $value;
627-
$valueext = 'G';
628-
}
629-
return round($value, 2) . $valueext;
630-
}
631-
632572
/**
633573
* Check if user has specified a preference for color scheme.
634574
*/

phpstan-baseline.neon

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -13266,21 +13266,6 @@ parameters:
1326613266
count: 1
1326713267
path: app/cdash/include/common.php
1326813268

13269-
-
13270-
message: "#^Function getByteValueWithExtension\\(\\) has parameter \\$base with no type specified\\.$#"
13271-
count: 1
13272-
path: app/cdash/include/common.php
13273-
13274-
-
13275-
message: "#^Function getByteValueWithExtension\\(\\) has parameter \\$value with no type specified\\.$#"
13276-
count: 1
13277-
path: app/cdash/include/common.php
13278-
13279-
-
13280-
message: "#^Function getByteValueWithExtension\\(\\) throws checked exception DivisionByZeroError but it's missing from the PHPDoc @throws tag\\.$#"
13281-
count: 3
13282-
path: app/cdash/include/common.php
13283-
1328413269
-
1328513270
message: "#^Function get_dashboard_JSON\\(\\) has no return type specified\\.$#"
1328613271
count: 1
@@ -13366,16 +13351,6 @@ parameters:
1336613351
count: 1
1336713352
path: app/cdash/include/common.php
1336813353

13369-
-
13370-
message: "#^Function qiv\\(\\) has no return type specified\\.$#"
13371-
count: 1
13372-
path: app/cdash/include/common.php
13373-
13374-
-
13375-
message: "#^Function qiv\\(\\) has parameter \\$iv with no type specified\\.$#"
13376-
count: 1
13377-
path: app/cdash/include/common.php
13378-
1337913354
-
1338013355
message: "#^Function qnum\\(\\) has no return type specified\\.$#"
1338113356
count: 1
@@ -13448,7 +13423,7 @@ parameters:
1344813423

1344913424
-
1345013425
message: "#^Loose comparison via \"\\=\\=\" is not allowed\\.$#"
13451-
count: 8
13426+
count: 7
1345213427
path: app/cdash/include/common.php
1345313428

1345413429
-

0 commit comments

Comments
 (0)