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

EnvLoader   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 18
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0
wmc 3
lcom 0
cbo 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
A test() 0 4 2
A load() 0 4 1
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