Passed
Push — master ( f9e900...3da772 )
by Ehsan
55s
created

GuzzleGet::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
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
     *
24
     * @return GuzzleHttp\Psr7\Response
25
     */
26 1
    public function submit(string $requestUrl)
27
    {
28 1
        $client = new Client();
29
30
        try {
31 1
            $response = $client->request('GET', $requestUrl);
32 1
        } catch (\Exception $e) {
33 1
            throw new DarkskyException($e->getMessage());
34
        }
35
36
        return $response->getBody();
37
    }
38
}
39