GuzzleGet::submit()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 12

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2.0185

Importance

Changes 0
Metric Value
dl 0
loc 12
ccs 5
cts 6
cp 0.8333
rs 9.8666
c 0
b 0
f 0
cc 2
nc 2
nop 1
crap 2.0185
1
<?php
2
3
namespace Darksky;
4
5
use GuzzleHttp\Client;
6
7
/**
8
 * Class GuzzleGet.
9
 */
10
class GuzzleGet implements RequestMethod
11
{
12
    /**
13
     * GuzzleGet constructor.
14
     */
15 1
    public function __construct()
16
    {
17 1
    }
18
19
    /**
20
     * @param string $requestUrl
21
     *
22
     * @throws DarkskyException
23
     * @throws \GuzzleHttp\Exception\GuzzleException
24
     *
25
     * @return \Psr\Http\Message\StreamInterface
26
     */
27 1
    public function submit(string $requestUrl)
28
    {
29 1
        $client = new Client();
30
31
        try {
32 1
            $response = $client->request('GET', $requestUrl);
33 1
        } catch (\Exception $e) {
34 1
            throw new DarkskyException($e->getMessage());
35
        }
36
37
        return $response->getBody();
38
    }
39
}
40