function Configuration::absoluteAndExistingPath

Returns an absolute file path, resolving relative ones from Drupal root.

Parameters

string $path: A file path.

Return value

string An absolute file path.

1 call to Configuration::absoluteAndExistingPath()
Configuration::loadDeprecationIgnorePatterns in core/tests/Drupal/TestTools/Extension/DeprecationBridge/Configuration.php
Loads the deprecation ignore patterns from the ignore file.

File

core/tests/Drupal/TestTools/Extension/DeprecationBridge/Configuration.php, line 109

Class

Configuration
Configuration for DeprecationHandler.

Namespace

Drupal\TestTools\Extension\DeprecationBridge

Code

private function absoluteAndExistingPath(string $path) : string {
  if (!str_starts_with($path, \DIRECTORY_SEPARATOR)) {
    $realPath = realpath(dirname(__DIR__, 6) . \DIRECTORY_SEPARATOR . $path);
  }
  else {
    $realPath = $path;
  }
  if ($realPath === FALSE || !is_file($realPath)) {
    throw new \InvalidArgumentException(sprintf('The file "%s" does not exist.', $path));
  }
  return $realPath;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.