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