function MockAliasManager::getAliasByPath

Same name in other branches
  1. 9 core/modules/system/src/Tests/Routing/MockAliasManager.php \Drupal\system\Tests\Routing\MockAliasManager::getAliasByPath()
  2. 10 core/modules/system/src/Tests/Routing/MockAliasManager.php \Drupal\system\Tests\Routing\MockAliasManager::getAliasByPath()
  3. 11.x core/modules/system/src/Tests/Routing/MockAliasManager.php \Drupal\system\Tests\Routing\MockAliasManager::getAliasByPath()

Parameters

$path:

null $langcode:

File

core/modules/system/src/Tests/Routing/MockAliasManager.php, line 79

Class

MockAliasManager
An easily configurable mock alias manager.

Namespace

Drupal\system\Tests\Routing

Code

public function getAliasByPath($path, $langcode = NULL) {
    if ($path[0] !== '/') {
        throw new \InvalidArgumentException(sprintf('Source path %s has to start with a slash.', $path));
    }
    $langcode = $langcode ?: $this->defaultLanguage;
    $this->lookedUp[$path] = 1;
    return $this->aliases[$path][$langcode];
}

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