Completed
Push — master ( d63249...f2b5fd )
by Changwan
02:39
created

EnvLoader::load()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
namespace Wandu\Config\Loader;
3
4
use M1\Env\Parser;
5
use Wandu\Config\Contracts\Loader;
6
7
class EnvLoader implements Loader
8
{
9
    /**
10
     * {@inheritdoc}
11
     */
12 2
    public function test(string $path): bool
13
    {
14 2
        return substr($path, -4) === '.env' && file_exists($path);
15
    }
16
17
    /**
18
     * {@inheritdoc}
19
     */
20 2
    public function load(string $path)
21
    {
22 2
        return (new Parser(file_get_contents($path)))->getContent();
23
    }
24
}
25