1<?php
2/**
3 * This file is part of the FreeDSx ASN1 package.
4 *
5 * (c) Chad Sikorra <Chad.Sikorra@gmail.com>
6 *
7 * For the full copyright and license information, please view the LICENSE
8 * file that was distributed with this source code.
9 */
10
11namespace FreeDSx\Asn1\Type;
12
13/**
14 * Represents an ASN1 integer type.
15 *
16 * @author Chad Sikorra <Chad.Sikorra@gmail.com>
17 */
18class IntegerType extends AbstractType
19{
20    use BigIntTrait;
21
22    protected $tagNumber = self::TAG_TYPE_INTEGER;
23
24    /**
25     * @param int|string $value
26     * @return $this
27     */
28    public function setValue($value)
29    {
30        $this->value = $value;
31
32        return $this;
33    }
34
35    /**
36     * @param string|int $tagNumber
37     * @param int $class
38     * @param string|int $value
39     * @return IntegerType
40     */
41    public static function withTag($tagNumber, int $class, $value)
42    {
43        $type = new self($value);
44        $type->tagNumber = $tagNumber;
45        $type->taggingClass = $class;
46
47        return $type;
48    }
49}
50