| Conditions | 4 |
| Paths | 2 |
| Total Lines | 20 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 12 |
| CRAP Score | 4 |
| Changes | 0 | ||
| 1 | <?php |
||
| 18 | 2 | public function execute($request) |
|
| 19 | { |
||
| 20 | 2 | RequestNotSupportedException::assertSupports($this, $request); |
|
| 21 | |||
| 22 | 2 | $details = ArrayObject::ensureArrayObject($request->getModel()); |
|
| 23 | |||
| 24 | 2 | $params = $this->api->createTransaction((array) $details); |
|
| 25 | |||
| 26 | 2 | $details->replace($params); |
|
| 27 | |||
| 28 | 2 | if (isset($params['url']) === false) { |
|
| 29 | 1 | throw new LogicException("Response content is not valid json: \n\n".urldecode(json_encode(array_map(function ($data) { |
|
| 30 | 1 | return is_string($data) === true ? urlencode($data) : $data; |
|
| 31 | 1 | }, $params)))); |
|
| 32 | } else { |
||
| 33 | 1 | throw new HttpRedirect($params['url'].'?locale='.$this->locale( |
|
| 34 | 1 | isset($details['locale']) === true ? $details['locale'] : 'zh-TW' |
|
| 35 | 1 | )); |
|
| 36 | } |
||
| 37 | } |
||
| 38 | |||
| 70 |