XmlResponse   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 6
c 0
b 0
f 0
dl 0
loc 10
ccs 6
cts 6
cp 1
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 1
1
<?php
2
3
namespace CommerceGuys\AuthNet\Response;
4
5
use CommerceGuys\AuthNet\Request\XmlRequest;
6
use Psr\Http\Message\ResponseInterface as HttpResponseInterface;
7
8
class XmlResponse extends BaseResponse
9
{
10 13
    public function __construct(HttpResponseInterface $response)
11
    {
12 13
        parent::__construct($response);
13 13
        $content = $this->response->getBody()->getContents();
14
        // The Authorize.net API does not return an absolute URL for XMLNS.
15 13
        $xml = @new \SimpleXMLElement($content);
16 13
        $json = json_encode((array) $xml);
17 13
        $this->contents = json_decode($json);
18 13
    }
19
}
20