GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

FileFactory::buildFromFile()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 11
rs 9.9
c 0
b 0
f 0
cc 2
nc 2
nop 1
1
<?php
2
3
4
5
namespace Katten\Purge\Factory;
6
7
8
use Katten\Purge\Exceptions\UnableToReadInFileException;
9
10
11
12
class FileFactory extends Factory {
13
14
15
    /**
16
     * Retrieve the contents of a file
17
     * 
18
     * @param string $file
19
     *      The file name or url to load from
20
     * 
21
     * @return string
22
     *      The contents of the file
23
     */ 
24
    public static function buildFromFile($file) {
25
    
26
        $output = @file_get_contents($file);
27
        
28
        
29
        if (!$output) {
30
            throw new UnableToReadInFileException("Unable to load file: $file");
31
        }
32
        
33
        return $output;
34
    }
35
36
37
}
38