EnvironmentFinder   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 2
dl 0
loc 32
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getFromFile() 0 8 2
A getFromFiles() 0 10 2
1
<?php
2
3
namespace Bmitch\Envsync\Finders;
4
5
class EnvironmentFinder
6
{
7
    /**
8
     * Gets the environment variables defined within $file.
9
     * @param  string $file Path and filename.
10
     * @return array
11
     */
12
    public function getFromFile($file)
13
    {
14
        if (preg_match("/.*.php/", $file)) {
15
            return PhpFileFinder::find($file);
16
        } else {
17
            return EnvFileFinder::find($file);
18
        }
19
    }
20
21
    /**
22
     * Gets the environment variables defined within the $files.
23
     * @param  array $files Array of paths and filenames.
24
     * @return array
25
     */
26
    public function getFromFiles(array $files)
27
    {
28
        $envs = [];
29
30
        foreach ($files as $file) {
31
            $envs = array_merge($envs, $this->getFromFile($file));
32
        }
33
34
        return $envs;
35
    }
36
}
37