src/Koldy/Config.php
public function getFirstKey(): string
    {
        $config = $this->data;

        if (count($config) == 0) {
            throw new ConfigException('Unable to get first config key when config is empty');
        }

        $key = array_keys($config)[0];

        if ($this->isPointerConfig()) {
            $counter = 0;
            while (is_string($key) && $counter++ < 50) {
                if (isset($this->data[$key])) {
                    $value = $this->data[$key];
                } else {
                    throw new ConfigException("{$this} found invalid config pointer named={$key}");
                }

                if (is_string($value)) {
                    $key = $value;
                }
            }

            if ($counter == 50) {
                throw new ConfigException('Unable to get first key in config after 50 "redirects"');
            }
        }

        return $key;
    }
public function getFirstKey(): string
    {
        $config = $this->data;

        if (count($config) == 0) {
            throw new ConfigException('Unable to get first config key when config is empty');
        }

        $key = array_keys($config)[0];

        if ($this->isPointerConfig()) {
            $counter = 0;
            while (is_string($key) && $counter++ < 50) {
                if (isset($this->data[$key])) {
                    $value = $this->data[$key];
                } else {
                    throw new ConfigException("{$this} found invalid config pointer named={$key}");
                }

                if (is_string($value)) {
                    $key = $value;
                }
            }

            if ($counter == 50) {
                throw new ConfigException('Unable to get first key in config after 50 "redirects"');
            }
        }

        return $key;
    }
public function getFirstKey ( ) : string { $ config = $ this -> data ; if ( count ( $ config ) == 0 ) { throw new ConfigException ( 'Unable to get first config key when config is empty' ) ; } $ key = array_keys ( $ config ) [ 0 ] ; if ( $ this -> isPointerConfig ( ) ) { $ counter = 0 ; while ( is_string ( $ key ) && $ counter ++ < 50 ) { if ( isset ( $ this -> data [ $ key ] ) ) { $ value = $ this -> data [ $ key ] ; } else { throw new ConfigException ( "{$this} found invalid config pointer named={$key}" ) ; } if ( is_string ( $ value ) ) { $ key = $ value ; } } if ( $ counter == 50 ) { throw new ConfigException ( 'Unable to get first key in config after 50 "redirects"' ) ; } } return $ key ; }
Get the first key in config. Useful for pointer configs.

@return string
@throws ConfigException
Get the first key in config . Useful for pointer configs .