protected function parseKey($key, callable $callback, ?array $result = null)
    {
        $parts = is_array($key) ? $key : explode('.', trim($key, '.'));
        $result = $result ?: $this->toArray();

        while (!is_null($part = array_shift($parts))) {
            if ($part == '*') {
                array_walk($result, function (&$value) use ($parts, $callback) {
                    $value = $this->parseKey($parts, $callback, $value);
                });

                return $result;
            }

            if (!$return = $callback($part, $result)) {
                return $return;
            }

            $result = $result[$part];
        }

        return $return;
    }
protected function parseKey($key, callable $callback, ?array $result = null)
    {
        $parts = is_array($key) ? $key : explode('.', trim($key, '.'));
        $result = $result ?: $this->toArray();

        while (!is_null($part = array_shift($parts))) {
            if ($part == '*') {
                array_walk($result, function (&$value) use ($parts, $callback) {
                    $value = $this->parseKey($parts, $callback, $value);
                });

                return $result;
            }

            if (!$return = $callback($part, $result)) {
                return $return;
            }

            $result = $result[$part];
        }

        return $return;
    }
protected function parseKey ( $ key , callable $ callback , ? array $ result = null ) { $ parts = is_array ( $ key ) ? $ key : explode ( '.' , trim ( $ key , '.' ) ) ; $ result = $ result ? : $ this -> toArray ( ) ; while ( ! is_null ( $ part = array_shift ( $ parts ) ) ) { if ( $ part == '*' ) { array_walk ( $ result , function ( & $ value ) use ( $ parts , $ callback ) { $ value = $ this -> parseKey ( $ parts , $ callback , $ value ) ; } ) ; return $ result ; } if ( ! $ return = $ callback ( $ part , $ result ) ) { return $ return ; } $ result = $ result [ $ part ] ; } return $ return ; }
Parses dotted notation.

@param array|string $key
@param callable     $callback
@param array|null   $result

@return mixed
Parses dotted notation .