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