code: protected function removeTrailingSlash($path)
      {
          if (substr($path, -1) == DIRECTORY_SEPARATOR) {
              return substr($path, 0, -1);
          } elseif (substr($path, -1) == '/') {
              return substr($path, 0, -1);
          } else {
              return $path;
          }
      }
docs: Strips off any kind of slash at the end so as to normalise the path.
  
  @param string $path Path to normalise.
  
  @return string Path without trailing slash.