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.

EnvLoader::parse()   A
last analyzed

Complexity

Conditions 5
Paths 4

Size

Total Lines 21

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 12
CRAP Score 5

Importance

Changes 0
Metric Value
dl 0
loc 21
ccs 12
cts 12
cp 1
rs 9.2728
c 0
b 0
f 0
cc 5
nc 4
nop 0
crap 5
1
<?php
2
namespace Dbtlr\PHPEnvBuilder;
3
4
use Dotenv\Exception\InvalidPathException;
5
use Dotenv\Loader;
6
7
class EnvLoader extends Loader
8
{
9
    /**
10
     * Load the environment if we need to or can.
11
     *
12
     * @return array
13
     */
14 4
    public function parse()
15
    {
16
        try {
17 4
            $this->ensureFileIsReadable();
18 2
        } catch (InvalidPathException $e) {
19 2
            return [];
20
        }
21
22 2
        $filePath = $this->filePath;
23 2
        $lines = $this->readLinesFromFile($filePath);
24
25 2
        $data = [];
26 2
        foreach ($lines as $line) {
27 2
            if (!$this->isComment($line) && $this->looksLikeSetter($line)) {
28 2
                list($name, $value) = $this->processFilters($line, null);
29 2
                $data[$name] = $value;
30
            }
31
        }
32
33 2
        return $data;
34
    }
35
}
36