public static function targetGet($needle, array $haystack, $default = null)
    {
        if ($needle === null) {
            return $haystack;
        }

        $parts  = preg_split('/(?<!\\\\)\./', $needle);

        foreach ($parts as $part) {
            $key = str_replace('\\.', '.', $part);

            if (
                is_array($haystack) === false ||
                array_key_exists($key, $haystack) === false
            ) {
                return $default;
            }

            $haystack = $haystack[$part];
        }

        return $haystack;
    }