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

Math   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 5
eloc 10
c 1
b 0
f 0
dl 0
loc 36
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getBigIntegerClass() 0 9 3
A setBigIntegerClass() 0 3 1
A createBigInteger() 0 5 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