ResponseFormatter::format()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 8
ccs 0
cts 5
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 2
1
<?php
2
3
namespace ByTIC\GouttePhantomJs\Clients\PhantomJs;
4
5
use JonnyW\PhantomJs\Http\ResponseInterface as JonnyWResponseInterface;
6
use Symfony\Component\BrowserKit\Response as BrowserKitResponse;
7
use Symfony\Contracts\HttpClient\ResponseInterface;
8
9
/**
10
 * Class ResponseBridge
11
 * @package ByTIC\GouttePhantomJs\Clients\PhantomJs
12
 */
13
class ResponseFormatter
14
{
15
16
    /**
17
     * ResponseBridge constructor.
18
     * @param \JonnyW\PhantomJs\Http\Response|\JonnyW\PhantomJs\Http\ResponseInterface $phantomJsResponse
19
     * @return BrowserKitResponse
20
     */
21
    public static function format(JonnyWResponseInterface $phantomJsResponse): ResponseInterface
22
    {
23
        $content = $phantomJsResponse->getContent();
24
        $status = $phantomJsResponse->getStatus();
25
        $headers = $phantomJsResponse->getHeaders();
26
27
        return new BrowserKitResponse($content, $status, $headers);
28
    }
29
}
30