schneespur/release/schneespur-1.0.2/vendor/brick/math/phpunit.php
Michael 7288b93500 Release v1.0.2: diagnostic infrastructure core
Add neutral diagnostic framework for future reporting modules:
- DiagnosticReporterInterface, Registry, Manager, PayloadSanitizer
- Laravel exception hook in bootstrap/app.php
- Module permission declarations (requires_permissions in module.json)
- Core diagnostic report points (module boot/install/update failures)
- Module documentation update (moduldoku.md)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-18 16:54:11 +00:00

52 lines
1.2 KiB
PHP

<?php
declare(strict_types=1);
use Brick\Math\Internal\Calculator;
use Brick\Math\Internal\CalculatorRegistry;
require __DIR__ . '/vendor/autoload.php';
function getCalculatorImplementation(): Calculator
{
switch ($calculator = getenv('CALCULATOR')) {
case 'GMP':
$calculator = new Calculator\GmpCalculator();
break;
case 'BCMath':
$calculator = new Calculator\BcMathCalculator();
break;
case 'Native':
$calculator = new Calculator\NativeCalculator();
break;
default:
if ($calculator === false) {
echo 'CALCULATOR environment variable not set!' . PHP_EOL;
} else {
echo 'Unknown calculator: ' . $calculator . PHP_EOL;
}
echo 'Example usage: CALCULATOR={calculator} vendor/bin/phpunit' . PHP_EOL;
echo 'Available calculators: GMP, BCMath, Native' . PHP_EOL;
exit(1);
}
echo 'Using ', get_class($calculator), PHP_EOL;
return $calculator;
}
CalculatorRegistry::set(getCalculatorImplementation());
$scale = getenv('BCMATH_DEFAULT_SCALE');
if ($scale !== false) {
echo "Using bcscale($scale)", PHP_EOL;
bcscale((int) $scale);
}