public static function extract(array $set, $path) {
        if (!$set) {
            return null;
        }

        // Exit early for faster processing
        if (strpos($path, '.') === false) {
            return isset($set[$path]) ? $set[$path] : null;
        }

        $search =& $set;
        $paths = explode('.', (string) $path);
        $total = count($paths);

        while ($total > 0) {
            $key = $paths[0];

            // Within the last path
            if ($total === 1) {
                return array_key_exists($key, $search) ? $search[$key] : null;

            // Break out of non-existent paths early
            } else if (!array_key_exists($key, $search) || !is_array($search[$key])) {
                return null;
            }

            $search =& $search[$key];
            array_shift($paths);
            $total--;
        }

        return null;
    }