You are here

public static function FillPdf::buildFileUri in FillPDF 8.4

Same name and namespace in other branches
  1. 5.0.x src/Component/Utility/FillPdf.php \Drupal\fillpdf\Component\Utility\FillPdf::buildFileUri()

Constructs a URI to a location given a relative path.

Parameters

string $scheme: A valid stream wrapper, such as 'public' or 'private'.

string $path: The path component that should come after the stream wrapper.

Return value

string The normalized URI.

5 calls to FillPdf::buildFileUri()
FillPdfFormForm::form in src/Form/FillPdfFormForm.php
Gets the actual form array to be built.
FillPdfOverviewForm::buildForm in src/Form/FillPdfOverviewForm.php
Form constructor.
FillPdfSettingsForm::validateForm in src/Form/FillPdfSettingsForm.php
Form validation handler.
FillPdfUploadTestBase::assertUploadPdfFile in tests/src/Functional/FillPdfUploadTestBase.php
Asserts that a PDF file may be properly uploaded as a template.
OutputHandler::processDestinationPath in src/OutputHandler.php
Processes the destination path.

File

src/Component/Utility/FillPdf.php, line 84

Class

FillPdf
Class FillPdf.

Namespace

Drupal\fillpdf\Component\Utility

Code

public static function buildFileUri($scheme, $path) {
  $uri = $scheme . '://' . $path;

  /** @var \Drupal\Core\StreamWrapper\StreamWrapperManagerInterface $streamWrapperManager */
  $streamWrapperManager = \Drupal::service('stream_wrapper_manager');

  // @todo: Remove once Drupal 8.7 is no longer supported.
  if (!method_exists(StreamWrapperManagerInterface::class, 'normalizeUri')) {
    return file_stream_wrapper_uri_normalize($uri);
  }
  return $streamWrapperManager
    ->normalizeUri($uri);
}