Code Duplication    Length = 14-14 lines in 2 locations

src/Config.php 2 locations

@@ 126-139 (lines=14) @@
123
     * @param string $path
124
     * @return string
125
     */
126
    protected function getByPath($path)
127
    {
128
        $segments = explode('.', $path);
129
        $value = $this;
130
        foreach ($segments as $segment) {
131
            if ($value->hasByKey($segment)) {
132
                $value = $value->getByKey($segment);
133
            } else {
134
                return null;
135
            }
136
        }
137
138
        return $value;
139
    }
140
141
    /**
142
     * @param $key
@@ 169-182 (lines=14) @@
166
     * @param string $path
167
     * @return bool
168
     */
169
    public function hasByPath($path)
170
    {
171
        $segments = explode('.', $path);
172
        $value = $this;
173
        foreach ($segments as $segment) {
174
            if ($value->hasByKey($segment)) {
175
                $value = $value->getByKey($segment);
176
            } else {
177
                return false;
178
            }
179
        }
180
181
        return ($value !== null);
182
    }
183
184
    /**
185
     * Determine if the given configuration option exists.