Skip to content

Commit

Permalink
Delete unused common.php functions (#2716)
Browse files Browse the repository at this point in the history
A bit of spring cleaning to remove functions which have been rendered
obsolete since my last pass through `common.php`.
  • Loading branch information
williamjallen authored Feb 19, 2025
1 parent c53db2f commit 4d97b62
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 86 deletions.
60 changes: 0 additions & 60 deletions app/cdash/include/common.php
Original file line number Diff line number Diff line change
Expand Up @@ -492,30 +492,6 @@ function date2day(string $date): string
return is_numeric(substr($date, 4, 1)) ? substr($date, 6, 2) : substr($date, 8, 2);
}

/**
* Get hour from formatted time
*/
function time2hour(string $time): string
{
return substr($time, 0, 2);
}

/**
* Get minute from formatted time
*/
function time2minute(string $time): string
{
return is_numeric(substr($time, 2, 1)) ? substr($time, 2, 2) : substr($time, 3, 2);
}

/**
* Get second from formatted time
*/
function time2second(string $time): string
{
return is_numeric(substr($time, 2, 1)) ? substr($time, 4, 2) : substr($time, 6, 2);
}

/** Get dates
* today: the *starting* timestamp of the current dashboard
* previousdate: the date in Y-m-d format of the previous dashboard
Expand Down Expand Up @@ -579,18 +555,6 @@ function make_cdash_url(string $url): string
return $url;
}

/**
* Quote SQL interval specifier
*/
function qiv($iv)
{
if (config('database.default') == 'pgsql') {
return "'$iv'";
} else {
return $iv;
}
}

/**
* Quote SQL number
*/
Expand All @@ -605,30 +569,6 @@ function qnum($num)
}
}

/**
* Return the byte value with proper extension
*/
function getByteValueWithExtension($value, $base = 1024): string
{
$valueext = '';
if ($value > $base) {
$value /= $base;
$value = $value;
$valueext = 'K';
}
if ($value > $base) {
$value /= $base;
$value = $value;
$valueext = 'M';
}
if ($value > $base) {
$value /= $base;
$value = $value;
$valueext = 'G';
}
return round($value, 2) . $valueext;
}

/**
* Check if user has specified a preference for color scheme.
*/
Expand Down
27 changes: 1 addition & 26 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -13266,21 +13266,6 @@ parameters:
count: 1
path: app/cdash/include/common.php

-
message: "#^Function getByteValueWithExtension\\(\\) has parameter \\$base with no type specified\\.$#"
count: 1
path: app/cdash/include/common.php

-
message: "#^Function getByteValueWithExtension\\(\\) has parameter \\$value with no type specified\\.$#"
count: 1
path: app/cdash/include/common.php

-
message: "#^Function getByteValueWithExtension\\(\\) throws checked exception DivisionByZeroError but it's missing from the PHPDoc @throws tag\\.$#"
count: 3
path: app/cdash/include/common.php

-
message: "#^Function get_dashboard_JSON\\(\\) has no return type specified\\.$#"
count: 1
Expand Down Expand Up @@ -13366,16 +13351,6 @@ parameters:
count: 1
path: app/cdash/include/common.php

-
message: "#^Function qiv\\(\\) has no return type specified\\.$#"
count: 1
path: app/cdash/include/common.php

-
message: "#^Function qiv\\(\\) has parameter \\$iv with no type specified\\.$#"
count: 1
path: app/cdash/include/common.php

-
message: "#^Function qnum\\(\\) has no return type specified\\.$#"
count: 1
Expand Down Expand Up @@ -13448,7 +13423,7 @@ parameters:

-
message: "#^Loose comparison via \"\\=\\=\" is not allowed\\.$#"
count: 8
count: 7
path: app/cdash/include/common.php

-
Expand Down

0 comments on commit 4d97b62

Please sign in to comment.