PhpHttpAdapter::getContent()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 13

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 2
dl 0
loc 13
ccs 4
cts 4
cp 1
crap 1
rs 9.8333
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
/**
6
 * PHP Domain Parser: Public Suffix List based URL parsing.
7
 *
8
 * @link      http://github.com/jeremykendall/php-domain-parser for the canonical source repository
9
 *
10
 * @copyright Copyright (c) 2014 Jeremy Kendall (http://about.me/jeremykendall)
11
 * @license   http://github.com/jeremykendall/php-domain-parser/blob/master/LICENSE MIT License
12
 */
13
14
namespace Pdp\HttpAdapter;
15
16
/**
17
 * php http adapter
18
 */
19
class PhpHttpAdapter implements HttpAdapterInterface
20
{
21
  /**
22
   * {@inheritdoc}
23
   */
24 1
  public function getContent($url, $timeout = 5)
25
  {
26 1
    $ctx = stream_context_create(
27
        [
28
            'http' =>
29
                [
30 1
                    'timeout' => $timeout,
31
                ],
32
        ]
33
    );
34
35 1
    return file_get_contents($url, false, $ctx);
36
  }
37
}
38