public static function arrayPathGet($array, $path)
    {
        if (!\is_array($path)) {
            $path = \array_filter(\preg_split('#[\./]#', $path), 'strlen');
        }
        $path = \array_reverse($path);
        while ($path) {
            $key = \array_pop($path);
            $arrayAccess = \is_array($array) || $array instanceof \ArrayAccess;
            if (!$arrayAccess) {
                return null;
            } elseif (isset($array[$key])) {
                $array = $array[$key];
            } elseif ($key == '__count__') {
                return \count($array);
            } elseif ($key == '__end__') {
                \end($array);
                $path[] = \key($array);
            } elseif ($key == '__reset__') {
                \reset($array);
                $path[] = \key($array);
            } else {
                return null;
            }
        }
        return $array;
    }