Code Duplication    Length = 16-17 lines in 2 locations

src/Driver/Environment.php 1 location

@@ 27-42 (lines=16) @@
24
    /**
25
     * @inheritdoc
26
     */
27
    public function get($key, $default = null)
28
    {
29
        $stored = self::getValue($key, false, $this->data);
30
        if ($stored !== false) {
31
            return $stored;
32
        }
33
34
        $value = $default;
35
        $fromEnvironment = getenv($this->transformKey($key));
36
37
        if ($fromEnvironment !== false) {
38
            $value = $fromEnvironment;
39
            self::setValue($key, $value, $this->data);
40
        }
41
        return $value;
42
    }
43
44
    /**
45
     * Transforms the provided key to a environment variable name

src/PriorityConfigurationChain.php 1 location

@@ 47-63 (lines=17) @@
44
     * @return mixed The stored value or the default value if key
45
     *  was not found.
46
     */
47
    public function get($key, $default = null)
48
    {
49
        $stored = static::getValue($key, false, $this->data);
50
        if ($stored !== false) {
51
            return $stored;
52
        }
53
54
        foreach ($this->priorityList as $driver) {
55
            $value = $driver->get($key, false);
56
            if ($value !== false) {
57
                $default = $value;
58
                static::setValue($key, $value, $this->data);
59
                break;
60
            }
61
        }
62
        return $default;
63
    }
64
65
    /**
66
     * Add a configuration driver to the chain