Mass update

This commit is contained in:
2022-12-30 21:03:37 +02:00
parent 7a5dfd22a7
commit e9ec7eb2f2
172 changed files with 14838 additions and 35914 deletions
@@ -2,14 +2,14 @@
namespace Insallah;
use Core\Database;
//use Core\Database;
use Exception;
use http\Message;
//use http\Message;
use PDO;
use PDOException;
use PDOStatement;
class Db
class DbOld
{
/**
* Íàñòðîéêè ïîäêëþ÷åíèÿ
+14 -3
View File
@@ -5,19 +5,30 @@ namespace Insallah;
/** All raw mathematics in one place. */
class Math
{
public static function getPercentage($total, $number)
/**
* @param float|int $total
* @param int|null $number
* @return float
*/
public static function getPercentage($total, ?int $number): float
{
if (is_null($number)) {
return 0;
}
return $total > 0 ? round(($number * 100) / $total, 2) : 0;
}
public static function get100Percentage($total, $number)
public static function get100Percentage($total, ?int $number)
{
if (is_null($number)) {
return 0;
}
return min(self::getPercentage($total, $number), 100);
}
/** Number-20% and Number+20% */
public static function get20PercentRange($number)
public static function get20PercentRange($number): array
{
return [
'min' => $number * ((100 - 20) / 100),