original_string: protected function prepareBasePath()
      {
          $baseUrl = $this->getBaseUrl();
          if (empty($baseUrl)) {
              return '';
          }
  
          $filename = basename($this->server->get('SCRIPT_FILENAME'));
          if (basename($baseUrl) === $filename) {
              $basePath = \dirname($baseUrl);
          } else {
              $basePath = $baseUrl;
          }
  
          if ('\\' === \DIRECTORY_SEPARATOR) {
              $basePath = str_replace('\\', '/', $basePath);
          }
  
          return rtrim($basePath, '/');
      }
code: protected function prepareBasePath()
      {
          $baseUrl = $this->getBaseUrl();
          if (empty($baseUrl)) {
              return '';
          }
  
          $filename = basename($this->server->get('SCRIPT_FILENAME'));
          if (basename($baseUrl) === $filename) {
              $basePath = \dirname($baseUrl);
          } else {
              $basePath = $baseUrl;
          }
  
          if ('\\' === \DIRECTORY_SEPARATOR) {
              $basePath = str_replace('\\', '/', $basePath);
          }
  
          return rtrim($basePath, '/');
      }
code_tokens: protected function prepareBasePath ( ) { $ baseUrl = $ this -> getBaseUrl ( ) ; if ( empty ( $ baseUrl ) ) { return '' ; } $ filename = basename ( $ this -> server -> get ( 'SCRIPT_FILENAME' ) ) ; if ( basename ( $ baseUrl ) === $ filename ) { $ basePath = \ dirname ( $ baseUrl ) ; } else { $ basePath = $ baseUrl ; } if ( '\\' === \ DIRECTORY_SEPARATOR ) { $ basePath = str_replace ( '\\' , '/' , $ basePath ) ; } return rtrim ( $ basePath , '/' ) ; }
docstring: Prepares the base path.
  
  @return string base path
docstring_tokens: Prepares the base path .