Code Duplication    Length = 13-14 lines in 2 locations

src/Driver/CommonDriverMethods.php 2 locations

@@ 81-93 (lines=13) @@
78
     * @return mixed The stored value or the default value if key
79
     *               or index was not found.
80
     */
81
    public static function getValue($key, $default, $data)
82
    {
83
        $parts = explode('.', $key);
84
        $first = array_shift($parts);
85
        if (isset($data[$first])) {
86
            if (count($parts) > 0) {
87
                $newKey = implode('.', $parts);
88
                return static::getValue($newKey, $default, $data[$first]);
89
            }
90
            $default = $data[$first];
91
        }
92
        return $default;
93
    }
94
    /**
95
     * Recursive method to parse dot notation keys and set the value
96
     *
@@ 101-114 (lines=14) @@
98
     * @param mixed  $value The value to store under the provided key.
99
     * @param array  $data  The data to search
100
     */
101
    public static function setValue($key, $value, &$data)
102
    {
103
        $parts = explode('.', $key);
104
        $first = array_shift($parts);
105
        if (count($parts) > 0) {
106
            $newKey = implode('.', $parts);
107
            if (!array_key_exists($first, $data)) {
108
                $data[$first] = array();
109
            }
110
            static::setValue($newKey, $value, $data[$first]);
111
            return;
112
        }
113
        $data[$first] = $value;
114
    }
115
}
116