���Root Mod By V1rus_Alfa
User / IP
:
216.73.217.78
Host / Server
:
195.214.235.115 / npln.ir
System
:
Linux damavand.pws-dns.net 5.14.0-503.35.1.el9_5.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Apr 4 05:23:43 EDT 2025 x86_64
Command
|
Upload
|
Mass Deface
|
Create
:
/
home2
/
cutunixc
/
repositories
/
npln
/
vendor
/
brick
/
math
/
src
/
Internal
/
Viewing: CalculatorRegistry.php
<?php declare(strict_types=1); namespace Brick\Math\Internal; use function extension_loaded; /** * Stores the current Calculator instance used by BigNumber classes. * * @internal */ final class CalculatorRegistry { /** * The Calculator instance in use. */ private static ?Calculator $instance = null; /** * Sets the Calculator instance to use. * * An instance is typically set only in unit tests: autodetect is usually the best option. * * @param Calculator|null $calculator The calculator instance, or null to revert to autodetect. */ final public static function set(?Calculator $calculator): void { self::$instance = $calculator; } /** * Returns the Calculator instance to use. * * If none has been explicitly set, the fastest available implementation will be returned. * * Note: even though this method is not technically pure, it is considered pure when used in a normal context, when * only relying on autodetect. * * @pure */ final public static function get(): Calculator { /** @phpstan-ignore impure.staticPropertyAccess */ if (self::$instance === null) { /** @phpstan-ignore impure.propertyAssign */ self::$instance = self::detect(); } /** @phpstan-ignore impure.staticPropertyAccess */ return self::$instance; } /** * Returns the fastest available Calculator implementation. * * @pure * * @codeCoverageIgnore */ private static function detect(): Calculator { if (extension_loaded('gmp')) { return new Calculator\GmpCalculator(); } if (extension_loaded('bcmath')) { return new Calculator\BcMathCalculator(); } return new Calculator\NativeCalculator(); } }
Coded With 💗 by
0x6ick Mod By V1rus_Alfa