Extracts install path

@param array $aPath path info array

@return string
500450
protected function _extractPath($aPath)
    {
        $sExtPath = '';
        $blBuildPath = false;
        for ($i = count($aPath); $i > 0; $i--) {
            $sDir = $aPath[$i - 1];
            if ($blBuildPath) {
                $sExtPath = $sDir . '/' . $sExtPath;
            }
            if (stristr($sDir, EditionPathProvider::SETUP_DIRECTORY)) {
                $blBuildPath = true;
            }
        }

        return $sExtPath;
    }
1262510
public function getCachePath($path, array $params = [])
    {
        $sourcePath = $this->getSourcePath($path);

        if ($this->sourcePathPrefix) {
            $sourcePath = substr($sourcePath, strlen($this->sourcePathPrefix) + 1);
        }

        $params = $this->getAllParams($params);
        unset($params['s'], $params['p']);
        ksort($params);

        $md5 = md5($sourcePath.'?'.http_build_query($params));

        $cachedPath = $this->groupCacheInFolders ? $sourcePath.'/'.$md5 : $md5;

        if ($this->cachePathPrefix) {
            $cachedPath = $this->cachePathPrefix.'/'.$cachedPath;
        }
        
        if ($this->cacheWithFileExtensions) {
            $ext = (isset($params['fm']) ? $params['fm'] : pathinfo($path)['extension']);
            $ext = ($ext === 'pjpg') ? 'jpg' : $ext;
            $cachedPath .= '.'.$ext;
        }

        return $cachedPath;
    }
717508
public function getPath($path)
    {
        if (($basePath = $this->getBasePath()) !== null) {
            return $basePath.DIRECTORY_SEPARATOR.ltrim($path, '/\\');
        }

        return $path;
    }
593740
protected function safePath($path)
    {
        $path = str_replace('\\', '/', $path);
        $path = preg_replace('/(\.+\\/)/', './', $path);
        $path = preg_replace('/(\\/+)/', '/', $path);
        return $path;
    }
622443
public static function extractPath($path)
    {
        $explodePath = explode(DIRECTORY_SEPARATOR, $path);
        $realPath = array();
        for ($i = 0, $parts = count($explodePath) - 1; $i < $parts; $i++) {
            $realPath[] = $explodePath[$i];
        }
        return implode(DIRECTORY_SEPARATOR, $realPath);
    }
168213
private static function extractPathname($path, $domains)
    {
        $filenamePath = $path;
        if (!empty($domains) && !file_exists($path)) {
            foreach ($domains as $domain => $paths) {
                $domainFilename = str_replace($domain, $paths['public'], $path);
                if (file_exists($domainFilename)) {
                    $filenamePath = $domainFilename;
                    continue;
                }
            }

        }

        return $filenamePath;
    }
144282
protected function getPathAsArray($path)
    {
        $path = str_replace('\/', '@@@', $path);
        $path = rtrim($path, "/");
        $segments = explode('/', $path);
        return array_map(function($item) {
            return str_replace('@@@', '/', $item);
        }, $segments);
    }
95220
public function applyNamespaceToPath($path)
    {
        /** @var ViewFinderInterface $finder */
        $finder = $this->getContainer()['view.finder'];
        if (!method_exists($finder, 'getHints')) {
            return $path;
        }
        $delimiter = $finder::HINT_PATH_DELIMITER;
        $hints = $finder->getHints();
        $view = array_reduce(array_keys($hints), function ($view, $namespace) use ($delimiter, $hints) {
            return str_replace($hints[$namespace], $namespace.$delimiter, $view);
        }, $path);
        return preg_replace("%{$delimiter}[\\/]*%", $delimiter, $view);
    }
1072278
public function parseXPath($pPath)
    {
        $path = str_replace('@app', '/', $pPath);
        $path = preg_replace('#^@module\[([a-z0-9/]+)\]|@layout#', '', $path);

        $pathArr = explode('/', $path);

        foreach($pathArr as $key => $node) {
            if (preg_match('/^([a-zA-Z0-9\[\]@\'"=_-]+):([a-zA-Z0-9_-]+)$/', $node, $matches)) {
                $pathArr[$key] = $matches[1] . '/attribute::' . $matches[2];
            } else if (preg_match('/^([a-zA-Z0-9_-]+):([a-zA-Z0-9_-]+)=([a-zA-Z0-9_-]+)$/', $node, $matches)) {
                $pathArr[$key] = $matches[1] . '[@' . $matches[2] . '="' . $matches[3] . '"]';
            } else if (preg_match('/^([a-zA-Z0-9_-]+)>([a-zA-Z0-9_-]+)=([a-zA-Z0-9_-]+)$/', $node, $matches)) {
                $pathArr[$key] = $matches[1] . '[' . $matches[2] . '="' . $matches[3] . '"]';
            }
        }

        return '//' . implode('/', $pathArr);
    }
1032454
protected function _getRalativePath($path)
    {
        if ($path) {
            $rootPath = str_replace(array('/', '\\'), '/', self::$_config['root']);

            $path = str_replace(array('/', '\\'), '/', $path);
            $path = str_replace($rootPath, '/', $path);
            $path = str_replace('//', '/', $path);
            $path = trim($path, '/');
        }
        return $path;
    }
69350
private function extractLocationIdFromPath(string $path): ?string
    {
        $pathParts = explode('/', trim($path, '/'));

        return array_pop($pathParts);
    }
616603
private function getAttributesXpath(array $attributes)
    {
        $xpath = '';
        if (!empty($attributes)) {
            $parts = [];
            foreach ($attributes as $key => $value) {
                $parts[] = '@' . $key . '="' . $value . '"';
            }

            $xpath .= '[' . implode(' and ', $parts) . ']';
        }

        return $xpath;
    }
787325
public function getPath(string $path = ''): string
    {
        return $this->dirPath.($path ? DIRECTORY_SEPARATOR.$path : $path);
    }
1148429
public function path($path = '')
    {
        $appPath = $this->appPath ?: $this->basePath.DIRECTORY_SEPARATOR.'app';

        return $appPath.($path ? DIRECTORY_SEPARATOR.$path : $path);
    }
808377
public static function getAbsolutePath(string $path): string
    {
        $parts = \preg_split('~[/\\\\]+~', $path, 0, \PREG_SPLIT_NO_EMPTY);
        $absolutes = [];
        foreach ($parts as $part) {
            if ('.' === $part) {
                continue;
            }
            if ('..' === $part) {
                \array_pop($absolutes);
            } else {
                $absolutes[] = $part;
            }
        }

        /**
         * Allows to dereference char
         */
        $__FILE__ = \preg_replace('~^(([a-z0-9\-]+)://)~', '', __FILE__);// remove file protocols such as "phar://" etc.
        $prefix = $__FILE__[0] === \DIRECTORY_SEPARATOR ? \DIRECTORY_SEPARATOR : '';
        return $prefix . \implode(\DIRECTORY_SEPARATOR, $absolutes);
    }
906622
private function getValidPath($path)
    {
        // If `$path` is array
        if (is_array($path)) {
            return $this->getPathFromArray($path);
        }

        // If `$path` is a directory
        if (is_dir($path)) {
            $paths = glob($path . '/*.*');
            if (empty($paths)) {
                throw new EmptyDirectoryException("Configuration directory: [$path] is empty");
            }
            return $paths;
        }

        // If `$path` is not a file, throw an exception
        if (!file_exists($path)) {
            throw new FileNotFoundException("Configuration file: [$path] cannot be found");
        }
        return array($path);
    }
414260
private function extractWebspaceFromPath($path)
    {
        $match = preg_match(
            sprintf(
                '/^\/%s\/([\w\.-]*?)\/.*$/',
                $this->pathSegmentRegistry->getPathSegment('base')
            ),
            $path,
            $matches
        );

        if ($match) {
            return $matches[1];
        }

        return;
    }