FileGetContents   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 10
dl 0
loc 20
ccs 0
cts 9
cp 0
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A fetch() 0 18 2
1
<?php
2
3
/*
4
 * This file is part of CacheTool.
5
 *
6
 * (c) Samuel Gordalina <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace CacheTool\Adapter\Http;
13
14
class FileGetContents extends AbstractHttp
15
{
16
    public function fetch($filename)
17
    {
18
        $url = "{$this->baseUrl}/{$filename}";
19
        $contents = @file_get_contents($url);
20
21
        if (false === $contents) {
22
            return serialize([
23
                'result' => false,
24
                'errors' => [
25
                    [
26
                        'no' => 0,
27
                        'str' => "file_get_contents() call failed with url: ${url}",
28
                    ],
29
                ],
30
            ]);
31
        }
32
33
        return $contents;
34
    }
35
}
36