Conditions | 2 |
Paths | 3 |
Total Lines | 18 |
Lines | 0 |
Ratio | 0 % |
Tests | 6 |
CRAP Score | 2.0625 |
Changes | 0 |
1 | <?php |
||
30 | 1 | public function post($url, SimpleXMLElement $body) |
|
31 | { |
||
32 | try { |
||
33 | 1 | $response = $this->client->request( |
|
34 | 1 | 'POST', |
|
35 | $url, |
||
36 | [ |
||
37 | 1 | 'headers' => ['Content-Type' => 'application/xml; charset=UTF-8'], |
|
38 | 1 | 'body' => $body->asXML(), |
|
39 | 'verify' => false |
||
40 | ] |
||
41 | ); |
||
42 | |||
43 | 1 | return new SimpleXMLElement($response->getBody()); |
|
44 | } catch (RequestException $e) { |
||
45 | throw PagSeguroException::create($e->getResponse(), $e); |
||
|
|||
46 | } |
||
47 | } |
||
48 | |||
65 |
Unless you are absolutely sure that the expression can never be null because of other conditions, we strongly recommend to add an additional type check to your code: