protected function Request::prepareBasePath

Prepares the base path.

Return value

string base path

1 call to Request::prepareBasePath()
Request::getBasePath in drupal/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Request.php
Returns the root path from which this request is executed.

File

drupal/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Request.php, line 1404

Class

Request
Request represents an HTTP request.

Namespace

Symfony\Component\HttpFoundation

Code

protected function prepareBasePath() {
  $filename = basename($this->server
    ->get('SCRIPT_FILENAME'));
  $baseUrl = $this
    ->getBaseUrl();
  if (empty($baseUrl)) {
    return '';
  }
  if (basename($baseUrl) === $filename) {
    $basePath = dirname($baseUrl);
  }
  else {
    $basePath = $baseUrl;
  }
  if ('\\' === DIRECTORY_SEPARATOR) {
    $basePath = str_replace('\\', '/', $basePath);
  }
  return rtrim($basePath, '/');
}