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 a Sequence type.
15 *
16 * @author Chad Sikorra <Chad.Sikorra@gmail.com>
17 */
18class SequenceType extends AbstractType
19{
20    /**
21     * @var int
22     */
23    protected $tagNumber = self::TAG_TYPE_SEQUENCE;
24
25    /**
26     * @var bool
27     */
28    protected $isConstructed = true;
29
30    /**
31     * @param AbstractType ...$types
32     */
33    public function __construct(...$types)
34    {
35        parent::__construct(null);
36        $this->children = $types;
37    }
38
39    /**
40     * @param string|int $tagNumber
41     * @param int $class
42     * @param array $children
43     * @return SequenceType
44     */
45    public static function withTag($tagNumber, int $class, array $children = [])
46    {
47        $type = new static();
48        $type->children = $children;
49        $type->tagNumber = $tagNumber;
50        $type->taggingClass = $class;
51
52        return $type;
53    }
54}
55