1 | <?php |
||
9 | class MultisigHD |
||
10 | { |
||
11 | /** |
||
12 | * @var int|string |
||
13 | */ |
||
14 | private $m; |
||
15 | |||
16 | /** |
||
17 | * @var string |
||
18 | */ |
||
19 | private $path; |
||
20 | |||
21 | /** |
||
22 | * @var HierarchicalKey[] |
||
23 | */ |
||
24 | private $keys; |
||
25 | |||
26 | /** |
||
27 | * @var HierarchicalKeySequence |
||
28 | */ |
||
29 | private $sequences; |
||
30 | |||
31 | /** |
||
32 | * @var bool |
||
33 | */ |
||
34 | private $sort; |
||
35 | |||
36 | /** |
||
37 | * @param int|string $m |
||
38 | * @param string $path |
||
39 | * @param array $keys |
||
40 | * @param HierarchicalKeySequence $sequences |
||
41 | * @param bool $sort |
||
42 | */ |
||
43 | 42 | public function __construct($m, $path, array $keys, HierarchicalKeySequence $sequences, $sort = false) |
|
70 | |||
71 | /** |
||
72 | * @param HierarchicalKey[] $keys |
||
73 | * @return HierarchicalKey[] |
||
74 | */ |
||
75 | 30 | private function sortHierarchicalKeys(array $keys) |
|
81 | |||
82 | /** |
||
83 | * @return string |
||
84 | */ |
||
85 | 6 | public function getPath() |
|
89 | |||
90 | /** |
||
91 | * Return the composite keys of this MultisigHD wallet entry. |
||
92 | * This will strictly adhere to the choice on whether keys should be sorted, since this is done in the constructor. |
||
93 | * |
||
94 | * @return HierarchicalKey[] |
||
95 | */ |
||
96 | 30 | public function getKeys() |
|
100 | |||
101 | /** |
||
102 | * Returns the redeemScript. Note - keys are already sorted in the constructor, so this is not required in ScriptFactory. |
||
103 | * |
||
104 | * @return \BitWasp\Bitcoin\Script\ScriptInterface |
||
105 | */ |
||
106 | 18 | public function getRedeemScript() |
|
110 | |||
111 | /** |
||
112 | * @return \BitWasp\Bitcoin\Address\ScriptHashAddress |
||
113 | */ |
||
114 | 12 | public function getAddress() |
|
118 | |||
119 | /** |
||
120 | * Derive each HK child and produce a new MultisigHD object |
||
121 | * |
||
122 | * @param int|string $sequence |
||
123 | * @return MultisigHD |
||
124 | */ |
||
125 | 12 | public function deriveChild($sequence) |
|
146 | |||
147 | /** |
||
148 | * @param array|\stdClass|\Traversable $list |
||
149 | * @return MultisigHD |
||
150 | */ |
||
151 | 12 | public function deriveFromList($list) |
|
162 | |||
163 | /** |
||
164 | * Derive a path in the tree of available addresses. |
||
165 | * |
||
166 | * @param string $path |
||
167 | * @return MultisigHD |
||
168 | */ |
||
169 | 12 | public function derivePath($path) |
|
173 | } |
||
174 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: