Debian Codegraph @

lib/3rdParty/composer/spomky-labs/pki-framework/src/X501/ASN1/AttributeValue/SerialNumberValue.php

raw symbols SCIP
1 <?php
2
3 declare(strict_types=1);
4
5 namespace SpomkyLabs\Pki\X501\ASN1\AttributeValue;
6
7 use SpomkyLabs\Pki\ASN1\Type\UnspecifiedType;
8 use SpomkyLabs\Pki\X501\ASN1\AttributeType;
9 use SpomkyLabs\Pki\X501\ASN1\AttributeValue\Feature\PrintableStringValue;
10
11 /**
12 * 'serialNumber' attribute value.
13 *
14 * @see https://www.itu.int/ITU-T/formal-language/itu-t/x/x520/2012/SelectedAttributeTypes.html#SelectedAttributeTypes.serialNumber
15 */
16 final class SerialNumberValue extends PrintableStringValue
17 {
18 /**
19 * @param string $value String value
20 */
21 protected function __construct(string $value)
22 {
23 parent::__construct(AttributeType::OID_SERIAL_NUMBER, $value);
24 }
25
26 public static function create(string $value): self
27 {
28 return new self($value);
29 }
30
31 public static function fromASN1(UnspecifiedType $el): self
32 {
33 return self::create($el->asPrintableString()->string());
34 }
35 }