Get::submit()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2.032

Importance

Changes 0
Metric Value
dl 0
loc 10
ccs 4
cts 5
cp 0.8
rs 9.9332
c 0
b 0
f 0
cc 2
nc 2
nop 1
crap 2.032
1
<?php
2
3
namespace Darksky;
4
5
/**
6
 * Class Get.
7
 */
8
class Get implements RequestMethod
9
{
10
    /**
11
     * Get constructor.
12
     */
13 7
    public function __construct()
14
    {
15 7
    }
16
17
    /**
18
     * @param $requestUrl
19
     *
20
     * @throws DarkskyException
21
     *
22
     * @return bool|string
23
     */
24 3
    public function submit(string $requestUrl)
25
    {
26 3
        $content = @file_get_contents($requestUrl);
27
28 3
        if ($content === false) {
29 3
            throw new DarkskyException("Failed reading: '{$requestUrl}'");
30
        }
31
32
        return $content;
33
    }
34
}
35