diff --git a/app/Providers/MacroServiceProvider.php b/app/Providers/MacroServiceProvider.php deleted file mode 100644 index 9eae42b81..000000000 --- a/app/Providers/MacroServiceProvider.php +++ /dev/null @@ -1,28 +0,0 @@ - 0.9) { - $size = $size / 1024; - $i++; - } - - return round($size, ($i < 2) ? 0 : $precision) . ' ' . $units[$i]; - }); - } -} diff --git a/app/helpers.php b/app/helpers.php index e66179387..0716fd214 100644 --- a/app/helpers.php +++ b/app/helpers.php @@ -1,34 +1,4 @@ . - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ -if (! function_exists('human_readable')) { - /** - * Generate a human-readable filesize for a given file path. - * - * @param string $path - * @param int $precision - * @return string - */ - function human_readable($path, $precision = 2) - { - if (is_numeric($path)) { - $i = 0; - while (($path / 1024) > 0.9) { - $path = $path / 1024; - $i++; - } - - return round($path, $precision) . ['B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'][$i]; - } - - return app('file')->humanReadableSize($path, $precision); - } -} if (! function_exists('is_digit')) { /** diff --git a/config/app.php b/config/app.php index eba84ca09..f57036f95 100644 --- a/config/app.php +++ b/config/app.php @@ -180,7 +180,6 @@ return [ Pterodactyl\Providers\EventServiceProvider::class, Pterodactyl\Providers\HashidsServiceProvider::class, Pterodactyl\Providers\RouteServiceProvider::class, - Pterodactyl\Providers\MacroServiceProvider::class, Pterodactyl\Providers\RepositoryServiceProvider::class, Pterodactyl\Providers\ViewComposerServiceProvider::class, diff --git a/tests/Unit/Helpers/HumanReadableTest.php b/tests/Unit/Helpers/HumanReadableTest.php deleted file mode 100644 index 4e46cad39..000000000 --- a/tests/Unit/Helpers/HumanReadableTest.php +++ /dev/null @@ -1,48 +0,0 @@ -. - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ - -namespace Tests\Unit\Helpers; - -use Tests\TestCase; - -class HumanReadableTest extends TestCase -{ - /** - * Test the human_readable helper. - * - * @dataProvider helperDataProvider - */ - public function testHelper($value, $response, $precision = 2) - { - $this->assertSame($response, human_readable($value, $precision)); - } - - /** - * Provide data to test against the helper function. - * - * @return array - */ - public function helperDataProvider() - { - return [ - [0, '0B'], - [1, '1B'], - [1024, '1kB'], - [10392, '10.15kB'], - [10392, '10kB', 0], - [10392, '10.148438kB', 6], - [1024000, '0.98MB'], - [1024000, '1MB', 0], - [102400000, '97.66MB'], - [102400000, '98MB', 0], - [102400000, '97.6563MB', 4], - [102400000, '97.65625MB', 10], - ]; - } -}