1 | <?php |
||
14 | class Targets implements \Countable, \IteratorAggregate |
||
15 | { |
||
16 | /** |
||
17 | * Target elements. |
||
18 | * |
||
19 | * @var Target[] $_targets |
||
20 | */ |
||
21 | protected $_targets; |
||
22 | |||
23 | /** |
||
24 | * Constructor |
||
25 | * |
||
26 | * @param Target ...$targets |
||
27 | */ |
||
28 | 11 | public function __construct(Target ...$targets) { |
|
31 | |||
32 | /** |
||
33 | * Initialize from ASN.1. |
||
34 | * |
||
35 | * @param Sequence $seq |
||
36 | * @return self |
||
37 | */ |
||
38 | 4 | public static function fromASN1(Sequence $seq) { |
|
45 | |||
46 | /** |
||
47 | * Get all targets. |
||
48 | * |
||
49 | * @return Target[] |
||
50 | */ |
||
51 | 7 | public function all() { |
|
54 | |||
55 | /** |
||
56 | * Get all targets of given type. |
||
57 | * |
||
58 | * @param int $type |
||
59 | * @return Target[] |
||
60 | */ |
||
61 | 7 | protected function _allOfType($type) { |
|
68 | |||
69 | /** |
||
70 | * Get all name targets. |
||
71 | * |
||
72 | * @return Target[] |
||
73 | */ |
||
74 | 1 | public function nameTargets() { |
|
75 | 1 | return $this->_allOfType(Target::TYPE_NAME); |
|
76 | } |
||
77 | |||
78 | /** |
||
79 | * Get all group targets. |
||
80 | * |
||
81 | * @return Target[] |
||
82 | */ |
||
83 | 1 | public function groupTargets() { |
|
86 | |||
87 | /** |
||
88 | * Check whether given target is present. |
||
89 | * |
||
90 | * @param Target $target |
||
91 | * @return boolean |
||
92 | */ |
||
93 | 4 | public function hasTarget(Target $target) { |
|
101 | |||
102 | /** |
||
103 | * Generate ASN.1 structure. |
||
104 | * |
||
105 | * @return Sequence |
||
106 | */ |
||
107 | 7 | public function toASN1() { |
|
114 | |||
115 | /** |
||
116 | * |
||
117 | * @see Countable::count() |
||
118 | * @return int |
||
119 | */ |
||
120 | 3 | public function count() { |
|
123 | |||
124 | /** |
||
125 | * Get iterator for targets. |
||
126 | * |
||
127 | * @see IteratorAggregate::getIterator() |
||
128 | * @return \ArrayIterator |
||
129 | */ |
||
130 | 1 | public function getIterator() { |
|
133 | } |
||
134 |