DotEnvFactory   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 2
dl 0
loc 47
ccs 12
cts 12
cp 1
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A createFromConstant() 0 6 1
A createFromEnvironmentVariable() 0 6 1
A createFromWorkingDirectory() 0 6 1
A create() 0 4 1
1
<?php
2
3
namespace Abacaphiliac\ZendPhpDotEnv;
4
5
use Dotenv\Dotenv;
6
7
class DotEnvFactory
8
{
9
    /**
10
     * @param string $name
11
     * @param string $file
12
     * @return Dotenv
13
     */
14 1
    public static function createFromConstant($name, $file)
15
    {
16 1
        $path = constant($name);
17
18 1
        return self::create($path, $file);
19
    }
20
21
    /**
22
     * @param string $name
23
     * @param string $file
24
     * @return Dotenv
25
     */
26 1
    public static function createFromEnvironmentVariable($name, $file)
27
    {
28 1
        $path = DotEnvLoader::getEnvironmentVariable($name);
29
30 1
        return self::create($path, $file);
31
    }
32
33
    /**
34
     * @param string $file
35
     * @return Dotenv
36
     */
37 1
    public static function createFromWorkingDirectory($file)
38 1
    {
39 1
        $path = getcwd();
40
41 1
        return self::create($path, $file);
42
    }
43
44
    /**
45
     * @param string $path
46
     * @param string $file
47
     * @return Dotenv
48
     */
49 4
    public static function create($path, $file)
50
    {
51 4
        return new Dotenv($path, $file);
52
    }
53
}
54