| @@ 115-129 (lines=15) @@ | ||
| 112 | * |
|
| 113 | * @return BIP32Path |
|
| 114 | */ |
|
| 115 | public function hardened() { |
|
| 116 | $path = $this->path; |
|
| 117 | ||
| 118 | $last = array_pop($path); |
|
| 119 | ||
| 120 | if (strpos($last, "'") !== false) { |
|
| 121 | return $this; |
|
| 122 | } |
|
| 123 | ||
| 124 | $last .= "'"; |
|
| 125 | ||
| 126 | $path[] = $last; |
|
| 127 | ||
| 128 | return new static($path); |
|
| 129 | } |
|
| 130 | ||
| 131 | /** |
|
| 132 | * unharden the last level of the path and return the new path |
|
| @@ 136-146 (lines=11) @@ | ||
| 133 | * |
|
| 134 | * @return BIP32Path |
|
| 135 | */ |
|
| 136 | public function unhardenedLast() { |
|
| 137 | $path = $this->path; |
|
| 138 | ||
| 139 | $last = array_pop($path); |
|
| 140 | ||
| 141 | $last = str_replace("'", "", $last); |
|
| 142 | ||
| 143 | $path[] = $last; |
|
| 144 | ||
| 145 | return new static($path); |
|
| 146 | } |
|
| 147 | ||
| 148 | /** |
|
| 149 | * unharden all levels of the path and return the new path |
|