detects root path

@return  string
198297
private function detectRootPath(): string
    {
        static $rootpath = null;
        if (null === $rootpath) {
            if (\Phar::running() !== '') {
                $rootpath = dirname(\Phar::running(false));
            } elseif (file_exists(__DIR__ . '/../../../../../autoload.php')) {
                // stubbles/values is inside the vendor dir of the application
                // it is a dependency of
                $rootpath = realpath(__DIR__ . '/../../../../../../');
            } else {
                // local checkout while development
                $rootpath = realpath(__DIR__ . '/../../../');
            }
        }

        return $rootpath;
    }
1300502
public static function getRootUrl()
    {
        if (empty(self::$root) && defined('ROOT_URL')) {
            self::$root = ROOT_URL;
            if (!preg_match("/\/$/", self::$root)) {
                self::$root .= '/';
            }
        }

        return self::$root;
    }
20792
protected function getFilePath()
    {
        $fullName = $this->fullName;

        $rootPath = public_path();

        $fullName = ltrim($fullName, '/');


        return $rootPath . '/' . $fullName;
    }
505421
protected function getRootOption(): string
    {
        $option = '';
        // if root is set
        if (!empty($this->repositoryRoot)) {
            // and it's not the current working directory
            if (getcwd() !== $this->repositoryRoot) {
                $option = ' -C ' . escapeshellarg($this->repositoryRoot);
            }
        }
        return $option;
    }
1177627
public function basePath()
    {
        if ($this->dirname && $this->basename) {
            return ($this->dirname .'/'. $this->basename);
        }

        return null;
    }
372120
private function buildRootPath()
    {
        // In Windows script path uses backslash, convert it:
        $scriptPath = str_replace('\\', '/', $_SERVER['PHP_SELF']);
        $rootPath = str_replace(' ', '%20', rtrim(substr($scriptPath, 0, strpos($scriptPath, 'index.php')), '/'));

        return $rootPath;
    }
489750
public function getRealPath()
    {
        $path = parent::getRealPath();
        if (empty($path)) {
            $path = $this->getRootDir().$this->getFilename();
        }
        return $path;
    }
258728
public function getRootPath()
  {
    $folder = WebApp::getPageFolder() . $this->code;
    if (StringTools::right($folder, 1) != '/') {
      $folder .= '/';
    }
    return $folder;
  }
208728
public function getCoreBasePath()
    {
        $pathWithoutLeadingAndTrailingSlashes = trim(trim($this->path), "/");
        $pathWithoutLastSegment = substr($pathWithoutLeadingAndTrailingSlashes, 0, strrpos($pathWithoutLeadingAndTrailingSlashes, "/"));
        return '/' . $pathWithoutLastSegment . '/';
    }
618489
public function rootDirExists()
    {
        $path = $this->getRootDir();
        return !empty($path) && @file_exists($path) && @is_dir($path);
    }
40487
public function get_root_path($code){
    /** @var array $dir The directory configuration */
    $dir = $this->dir($code);
    if ( $dir ){
      $path = $this->decipher_path(bbn\str::parse_path($dir['bbn_path'].(!empty($dir['path']) ? '/' . $dir['path'] : '')));

      $r = bbn\str::parse_path($path.'/');
      return $r;
    }
    return false;
  }
278756
public function relative_file_root_path()
    {
        $subDirs = implode('/', $this->subDirs);
        if ($subDirs) {
            $subDirs .= '/';
        }
        return $subDirs . $this->fileRoot;
    }
1267342
public function getPathRelativeToRoot(): string
    {
        if (is_null($this->conversion)) {
            return $this->pathGenerator->getPath($this->media).($this->media->file_name);
        }

        return $this->pathGenerator->getPathForConversions($this->media)
            .pathinfo($this->media->file_name, PATHINFO_FILENAME)
            .'-'.$this->conversion->getName()
            .'.'
            .$this->conversion->getResultExtension($this->media->extension);
    }
1327816
public static function getProjectRootPath()
    {
        $projectRootPath = '';

        $fileName = 'composer.json';
        $directoryPath = __DIR__;

        // Path of directory it's not the path of last directory?
        while (DIRECTORY_SEPARATOR !== $directoryPath) {
            $filePath = static::concatenatePaths($directoryPath, $fileName);

            /*
             * Is here file we are looking for?
             * Maybe it's a project's root path
             */
            if (file_exists($filePath)) {
                $projectRootPath = $directoryPath;
            }

            $directoryPath = dirname($directoryPath);
        }

        return $projectRootPath;
    }
1010797
def get_root_path():
    """"""
    return os.path.realpath(os.path.join(os.path.dirname(__file__), os.pardir))
1315040
public static function getBasicPath() {
        $s = &$_SERVER;
        $ssl = (!empty($s['HTTPS']) && $s['HTTPS'] == 'on') ? true : false;
        $sp = strtolower($s['SERVER_PROTOCOL']);
        $protocol = substr($sp, 0, strpos($sp, '/')) . (($ssl) ? 's' : '');
        $port = $s['SERVER_PORT'];
        $port = ((!$ssl && $port == '80') || ($ssl && $port == '443')) ? '' : ':' . $port;
        $host = isset($s['HTTP_X_FORWARDED_HOST']) ? $s['HTTP_X_FORWARDED_HOST'] : (isset($s['HTTP_HOST']) ? $s['HTTP_HOST'] : null);
        $host = isset($host) ? $host : $s['SERVER_NAME'] . $port;
        $uri = $protocol . '://' . $host;
        return $uri;
    }
353055
public function getRelativePath()
    {
        $root = $this;
        while ($root->getParent() != null) {
            $root = $root->getParent();
        }

        return substr($this->path, strlen($root->getPath()) + 1);
    }