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

PhpLoader   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

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 0

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 Wandu\Config\Contracts\Loader;
5
6
class PhpLoader implements Loader
7
{
8
    /**
9
     * {@inheritdoc}
10
     */
11 2
    public function test(string $path): bool
12
    {
13 2
        return substr($path, -4) === '.php' && file_exists($path);
14
    }
15
16
    /**
17
     * {@inheritdoc}
18
     */
19 2
    public function load(string $path)
20
    {
21 2
        return require $path;
22
    }
23
}
24