| @@ 100-116 (lines=17) @@ | ||
| 97 | return $parseMap['success'][0]; |
|
| 98 | } |
|
| 99 | ||
| 100 | if (count($parseMap['success']) > 1) { |
|
| 101 | throw new UnableToCreateAccountException( |
|
| 102 | sprintf( |
|
| 103 | 'Unable to parse account %s, multiple matching formats: %s.', |
|
| 104 | $number, |
|
| 105 | implode( |
|
| 106 | ' and ', |
|
| 107 | array_map( |
|
| 108 | function (AccountNumber $account) { |
|
| 109 | return $account->getBankName(); |
|
| 110 | }, |
|
| 111 | $parseMap['success'] |
|
| 112 | ) |
|
| 113 | ) |
|
| 114 | ) |
|
| 115 | ); |
|
| 116 | } |
|
| 117 | ||
| 118 | if (count($parseMap['rewrite']) == 1 && $this->allowRewrites) { |
|
| 119 | return $parseMap['rewrite'][0]; |
|
| @@ 122-138 (lines=17) @@ | ||
| 119 | return $parseMap['rewrite'][0]; |
|
| 120 | } |
|
| 121 | ||
| 122 | if ($parseMap['rewrite']) { |
|
| 123 | throw new UnableToCreateAccountException( |
|
| 124 | sprintf( |
|
| 125 | 'Unable to parse account %s. You may rewrite number as: %s.', |
|
| 126 | $number, |
|
| 127 | implode( |
|
| 128 | ' or ', |
|
| 129 | array_map( |
|
| 130 | function (AccountNumber $account) { |
|
| 131 | return $account->getNumber(); |
|
| 132 | }, |
|
| 133 | $parseMap['rewrite'] |
|
| 134 | ) |
|
| 135 | ) |
|
| 136 | ) |
|
| 137 | ); |
|
| 138 | } |
|
| 139 | ||
| 140 | if ($parseMap['exception']) { |
|
| 141 | throw new UnableToCreateAccountException( |
|