These functions do not seem to be used anywhere, removing...
Signed-off-by: Madhura Jayaratne <madhura.cj@gmail.com>
This commit is contained in:
parent
72d180afd8
commit
33a30ad7ae
@ -456,63 +456,4 @@ class Advisor
|
||||
return array('rules' => $rules, 'lines' => $lines, 'errors' => $errors);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Formats interval like 10 per hour
|
||||
*
|
||||
* @param integer $num number to format
|
||||
* @param integer $precision required precision
|
||||
*
|
||||
* @return string formatted string
|
||||
*/
|
||||
function ADVISOR_bytime($num, $precision)
|
||||
{
|
||||
if ($num >= 1) { // per second
|
||||
$per = __('per second');
|
||||
} elseif ($num * 60 >= 1) { // per minute
|
||||
$num = $num * 60;
|
||||
$per = __('per minute');
|
||||
} elseif ($num * 60 * 60 >= 1 ) { // per hour
|
||||
$num = $num * 60 * 60;
|
||||
$per = __('per hour');
|
||||
} else {
|
||||
$num = $num * 60 * 60 * 24;
|
||||
$per = __('per day');
|
||||
}
|
||||
|
||||
$num = round($num, $precision);
|
||||
|
||||
if ($num == 0) {
|
||||
$num = '<' . PMA_Util::pow(10, -$precision);
|
||||
}
|
||||
|
||||
return "$num $per";
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper for PMA_Util::timespanFormat
|
||||
*
|
||||
* @param int $seconds the timespan
|
||||
*
|
||||
* @return string the formatted value
|
||||
*/
|
||||
function ADVISOR_timespanFormat($seconds)
|
||||
{
|
||||
return PMA_Util::timespanFormat($seconds);
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper around PMA_Util::formatByteDown
|
||||
*
|
||||
* @param double $value the value to format
|
||||
* @param int $limes the sensitiveness
|
||||
* @param int $comma the number of decimals to retain
|
||||
*
|
||||
* @return string the formatted value with unit
|
||||
*/
|
||||
function ADVISOR_formatByteDown($value, $limes = 6, $comma = 0)
|
||||
{
|
||||
return implode(' ', PMA_Util::formatByteDown($value, $limes, $comma));
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@ -79,37 +79,6 @@ class Advisor_Test extends PHPUnit_Framework_TestCase
|
||||
$this->assertEquals($parseResult['errors'], array());
|
||||
}
|
||||
|
||||
/**
|
||||
* test for ADVISOR_bytime
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testAdvisorBytime()
|
||||
{
|
||||
$result = ADVISOR_bytime(10, 2);
|
||||
$this->assertEquals("10 per second", $result);
|
||||
|
||||
$result = ADVISOR_bytime(0.02, 2);
|
||||
$this->assertEquals("1.2 per minute", $result);
|
||||
|
||||
$result = ADVISOR_bytime(0.003, 2);
|
||||
$this->assertEquals("10.8 per hour", $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* test for ADVISOR_timespanFormat
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testAdvisorTimespanFormat()
|
||||
{
|
||||
$result = ADVISOR_timespanFormat(1200);
|
||||
$this->assertEquals("0 days, 0 hours, 20 minutes and 0 seconds", $result);
|
||||
|
||||
$result = ADVISOR_timespanFormat(100);
|
||||
$this->assertEquals("0 days, 0 hours, 1 minutes and 40 seconds", $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for adding rule
|
||||
*
|
||||
|
||||
Loading…
Reference in New Issue
Block a user