| @@ 156-172 (lines=17) @@ | ||
| 153 | return $parseMap['success'][0]; |
|
| 154 | } |
|
| 155 | ||
| 156 | if (count($parseMap['success']) > 1) { |
|
| 157 | throw new UnableToCreateAccountException( |
|
| 158 | sprintf( |
|
| 159 | 'Unable to parse account %s, multiple matching formats: %s.', |
|
| 160 | $number, |
|
| 161 | implode( |
|
| 162 | ' and ', |
|
| 163 | array_map( |
|
| 164 | function (AccountNumber $account) { |
|
| 165 | return $account->getBankName(); |
|
| 166 | }, |
|
| 167 | $parseMap['success'] |
|
| 168 | ) |
|
| 169 | ) |
|
| 170 | ) |
|
| 171 | ); |
|
| 172 | } |
|
| 173 | ||
| 174 | if (count($parseMap['rewrite']) == 1 && $this->allowRewrites) { |
|
| 175 | return $parseMap['rewrite'][0]; |
|
| @@ 178-194 (lines=17) @@ | ||
| 175 | return $parseMap['rewrite'][0]; |
|
| 176 | } |
|
| 177 | ||
| 178 | if ($parseMap['rewrite']) { |
|
| 179 | throw new UnableToCreateAccountException( |
|
| 180 | sprintf( |
|
| 181 | 'Unable to parse account %s. You may rewrite number as: %s.', |
|
| 182 | $number, |
|
| 183 | implode( |
|
| 184 | ' or ', |
|
| 185 | array_map( |
|
| 186 | function (AccountNumber $account) { |
|
| 187 | return $account->getNumber(); |
|
| 188 | }, |
|
| 189 | $parseMap['rewrite'] |
|
| 190 | ) |
|
| 191 | ) |
|
| 192 | ) |
|
| 193 | ); |
|
| 194 | } |
|
| 195 | ||
| 196 | if ($parseMap['exception']) { |
|
| 197 | throw new UnableToCreateAccountException( |
|