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.

File::canRead()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
/**
3
 * File.php
4
 *
5
 * @package         ProjectVersioner
6
 * @subpackage      Reader
7
 */
8
9
namespace Naneau\ProjectVersioner\Reader;
10
11
use Naneau\ProjectVersioner\ReaderInterface;
12
13
/**
14
 * File
15
 *
16
 * Reads a version from a file
17
 *
18
 * @category        Naneau
19
 * @package         ProjectVersioner
20
 * @subpackage      Reader
21
 */
22
class File implements ReaderInterface
23
{
24
    /**
25
     * The file
26
     *
27
     * @var string
28
     **/
29
    private $file;
30
31
    /**
32
     * Constructor
33
     *
34
     * @param  string $file version file
35
     * @return void
0 ignored issues
show
Comprehensibility Best Practice introduced by
Adding a @return annotation to constructors is generally not recommended as a constructor does not have a meaningful return value.

Adding a @return annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.

Please refer to the PHP core documentation on constructors.

Loading history...
36
     **/
37
    public function __construct($file)
38
    {
39
        $this->setFile($file);
40
    }
41
42
    /**
43
     * {@inheritdoc}
44
     **/
45
    public function canRead($directory)
46
    {
47
        return is_readable($directory . DIRECTORY_SEPARATOR . $this->getFile());
48
    }
49
50
    /**
51
     * {@inheritdoc}
52
     **/
53
    public function read($directory)
54
    {
55
        return trim(file_get_contents($directory . DIRECTORY_SEPARATOR . $this->getFile()));
56
    }
57
58
    /**
59
     * Get the file
60
     *
61
     * @return string
62
     */
63
    public function getFile()
64
    {
65
        return $this->file;
66
    }
67
68
    /**
69
     * Set the file
70
     *
71
     * @param  string $file
72
     * @return parent
73
     */
74
    public function setFile($file)
75
    {
76
        $this->file = $file;
77
78
        return $this;
79
    }
80
81
}
82