Completed
Push — master ( ac431a...f1ddbd )
by Michele
17s queued 12s
created

Math::setBigIntegerClass()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 1
1
<?php
2
3
namespace Ocsp\Service;
4
5
final class Math
6
{
7
    private static $bigIntegerClass = '';
8
9
    /**
10
     * Set the name of the class for new BigInteger instances
11
     *
12
     * @param string|null $className can be 'phpseclib3\Math\BigInteger' or 'phpseclib\Math\BigInteger'. If an empty string (or NULL) is passed, we'll detect it automatically
13
     */
14
    public static function setBigIntegerClass($className)
15
    {
16
        self::$bigIntegerClass = (string) $className;
17
    }
18
19
    public static function getBigIntegerClass()
20
    {
21
        if (self::$bigIntegerClass === '') {
22
            self::$bigIntegerClass = 'phpseclib3\Math\BigInteger';
23
            if (!class_exists(self::$bigIntegerClass)) {
24
                self::$bigIntegerClass = 'phpseclib\Math\BigInteger';
25
            }
26
        }
27
        return self::$bigIntegerClass;
28
    }
29
30
    /**
31
     * @param string|int|resource|\phpseclib3\Math\BigInteger\Engines\Engine $x
0 ignored issues
show
Bug introduced by
The type phpseclib3\Math\BigInteger\Engines\Engine was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
32
     * @param int $base
33
     *
34
     * @return \phpseclib\Math\BigInteger|\phpseclib3\Math\BigInteger
0 ignored issues
show
Bug introduced by
The type phpseclib3\Math\BigInteger was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
35
     */
36
    public static function createBigInteger($x, $base = 10)
37
    {
38
        $class = self::getBigIntegerClass();
39
40
        return new $class($x, $base);
41
    }
42
}
43