Conditions | 4 |
Paths | 4 |
Total Lines | 19 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 4.7691 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
40 | 2 | private function loadEnvironment() |
|
41 | { |
||
42 | 2 | if (!file_exists(realpath($this->dir) . '/' . $this->filename)) { |
|
43 | 1 | return false; |
|
44 | } |
||
45 | |||
46 | 1 | if (class_exists('Dotenv\Dotenv')) { //2.x branch |
|
47 | 1 | $dotenv = new \Dotenv\Dotenv($this->dir, $this->filename); |
|
48 | 1 | $dotenv->load(); |
|
49 | |||
50 | 1 | return true; |
|
51 | } elseif (class_exists('DotEnv')) { |
||
52 | \Dotenv::load($this->dir, $this->filename); |
||
53 | |||
54 | return true; |
||
55 | } |
||
56 | |||
57 | throw new \RuntimeException('no suitable .env loader found'); |
||
58 | } |
||
59 | } |
||
60 |