FileGetContentsHttpClient::get()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 9
rs 10
cc 2
nc 2
nop 1
1
<?php
2
3
namespace Digia\Lumen\SnsMiddleware\Http\Client;
4
5
/**
6
 * Class FileGetContentsHttpClient
7
 * @package Digia\Lumen\SnsMiddleware\Http\Client
8
 */
9
class FileGetContentsHttpClient implements HttpClientInterface
10
{
11
12
    /**
13
     * @inheritdoc
14
     */
15
    public function get(string $url): string
16
    {
17
        $contents = @file_get_contents($url);
18
19
        if ($contents === false) {
20
            throw new \RuntimeException('Failed to perform HTTP request');
21
        }
22
23
        return $contents;
24
    }
25
26
}
27