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 OID ASN1 type.
15 *
16 * @author Chad Sikorra <Chad.Sikorra@gmail.com>
17 */
18class OidType extends AbstractType
19{
20    protected $tagNumber = self::TAG_TYPE_OID;
21
22    /**
23     * @param string $value
24     */
25    public function __construct(string $value)
26    {
27        parent::__construct($value);
28    }
29
30    /**
31     * @param string $oid
32     * @return $this
33     */
34    public function setValue(string $oid)
35    {
36        $this->value = $oid;
37
38        return $this;
39    }
40
41    /**
42     * @param int|string $tagNumber
43     * @param int $class
44     * @param string $value
45     * @return OidType
46     */
47    public static function withTag($tagNumber, int $class, string $value)
48    {
49        $type = new self($value);
50        $type->tagNumber = $tagNumber;
51        $type->taggingClass = $class;
52
53        return $type;
54    }
55}
56