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

GuzzleGet   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 87.5%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 3
dl 0
loc 29
ccs 7
cts 8
cp 0.875
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A submit() 0 12 2
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