Integer::getClass()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
namespace Ocsp\Asn1\Element;
4
5
use Ocsp\Asn1\Encoder;
6
use Ocsp\Asn1\TaggableElement;
7
use Ocsp\Asn1\TaggableElementTrait;
8
use Ocsp\Asn1\UniversalTagID;
9
10
/**
11
 * ASN.1 element: INTEGER.
12
 */
13
class Integer implements TaggableElement
14
{
15
    use TaggableElementTrait;
16
17
    /**
18
     * @var int|string|\phpseclib\Math\BigInteger|\phpseclib3\Math\BigInteger
0 ignored issues
show
Bug introduced by
The type phpseclib\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...
19
     */
20
    private $value;
21
22
    /**
23
     * Create a new instance.
24
     *
25
     * @param int|string|\phpseclib\Math\BigInteger|\phpseclib3\Math\BigInteger $value
26
     *
27
     * @return static
28
     */
29 3
    public static function create($value)
30
    {
31 3
        $result = new static();
32
33 3
        return $result->setValue($value);
34
    }
35
36
    /**
37
     * {@inheritdoc}
38
     *
39
     * @see \Ocsp\Asn1\Element::getClass()
40
     */
41 2
    public function getClass()
42
    {
43 2
        return static::CLASS_UNIVERSAL;
44
    }
45
46
    /**
47
     * {@inheritdoc}
48
     *
49
     * @see \Ocsp\Asn1\Element::getTypeID()
50
     */
51 3
    public function getTypeID()
52
    {
53 3
        return UniversalTagID::INTEGER;
54
    }
55
56
    /**
57
     * {@inheritdoc}
58
     *
59
     * @see \Ocsp\Asn1\Element::isConstructed()
60
     */
61 2
    public function isConstructed()
62
    {
63 2
        return false;
64
    }
65
66
    /**
67
     * @return int|string|\phpseclib\Math\BigInteger|\phpseclib3\Math\BigInteger
68
     */
69 2
    public function getValue()
70
    {
71 2
        return $this->value;
72
    }
73
74
    /**
75
     * @param int|string|\phpseclib\Math\BigInteger|\phpseclib3\Math\BigInteger $value
76
     *
77
     * @return $this
78
     */
79 3
    public function setValue($value)
80
    {
81 3
        $this->value = $value;
82
83 3
        return $this;
84
    }
85
86
    /**
87
     * {@inheritdoc}
88
     *
89
     * @see \Ocsp\Asn1\Element::getEncodedValue()
90
     */
91 2
    public function getEncodedValue(Encoder $encoder)
92
    {
93 2
        return $encoder->encodeInteger($this->getValue());
94
    }
95
}
96