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.
Completed
Push — master ( 784a42...226f28 )
by Gjero
03:03
created

File::open()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 2
eloc 5
c 1
b 0
f 1
nc 2
nop 0
dl 0
loc 10
rs 9.4285
1
<?php
2
/**
3
 * Pimf
4
 *
5
 * @copyright Copyright (c)  Gjero Krsteski (http://krsteski.de)
6
 * @license   http://opensource.org/licenses/MIT MIT License
7
 */
8
9
namespace Pimf\Adapter;
10
11
use Pimf\Contracts\Streamable;
12
13
/**
14
 * Class File binds a named resource, specified by filename, to a stream.
15
 *
16
 * @package Pimf\Adapter
17
 */
18
class File implements Streamable
19
{
20
    /**
21
     * @var string
22
     */
23
    protected $storageDir;
24
25
    /**
26
     * @var string
27
     */
28
    protected $fileName;
29
30
    /**
31
     * Specifies the type of access you require to the stream
32
     * @see http://php.net/manual/en/function.fopen.php#mode
33
     * @var string
34
     */
35
    protected $mode;
36
37
    /**
38
     * @param string $storageDir
39
     * @param string $fileName
40
     * @param string $mode
41
     */
42
    public function __construct($storageDir, $fileName = "pimf-logs.txt", $mode = "at+")
43
    {
44
        $this->storageDir = $storageDir;
45
        $this->fileName = $fileName;
46
        $this->mode = $mode;
47
    }
48
49
    /* @inheritdoc */
50
    public function open()
51
    {
52
        if (!is_dir($this->storageDir)) {
53
            mkdir($this->storageDir, 0777);
54
        }
55
56
        $this->storageDir = rtrim(realpath($this->storageDir), '\\/') . DS;
57
58
        return fopen($this->storageDir . $this->fileName, $this->mode);
59
    }
60
}