DmitryDulepov\Realurl\Configuration\ConfigurationReader::getFromConfiguration PHP Method

getFromConfiguration() protected method

Obtains the value by path from the configuration.
See also: get()
protected getFromConfiguration ( string $path ) : mixed
$path string
return mixed
    protected function getFromConfiguration($path)
    {
        $path = trim($path, '/');
        $value = $this->getDefaultValue($path);
        $configuration = $this->configuration;
        $segments = explode('/', $path);
        $segmentCount = count($segments);
        for ($currentSegmentNumber = 0; $currentSegmentNumber < $segmentCount; $currentSegmentNumber++) {
            $key = $segments[$currentSegmentNumber];
            if ($currentSegmentNumber < $segmentCount - 1) {
                // Must be an array
                if (isset($configuration[$key]) && is_array($configuration[$key])) {
                    $configuration = $configuration[$key];
                } else {
                    break;
                }
            } elseif (isset($configuration[$key])) {
                $value = $configuration[$key];
            }
        }
        return $value;
    }