summaryrefslogtreecommitdiffstatshomepage
path: root/core/modules/path_alias/src/AliasManagerInterface.php
blob: dca8fd11143691f2f927a20c3d3e0ce1cae6b8c6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php

namespace Drupal\path_alias;

/**
 * Find an alias for a path and vice versa.
 *
 * @see \Drupal\path_alias\AliasStorageInterface
 */
interface AliasManagerInterface {

  /**
   * Given the alias, return the path it represents.
   *
   * @param string $alias
   *   An alias.
   * @param string $langcode
   *   An optional language code to look up the path in.
   *
   * @return string
   *   The path represented by alias, or the alias if no path was found.
   *
   * @throws \InvalidArgumentException
   *   Thrown when the path does not start with a slash.
   */
  public function getPathByAlias($alias, $langcode = NULL);

  /**
   * Given a path, return the alias.
   *
   * @param string $path
   *   A path.
   * @param string $langcode
   *   An optional language code to look up the path in.
   *
   * @return string
   *   An alias that represents the path, or path if no alias was found.
   *
   * @throws \InvalidArgumentException
   *   Thrown when the path does not start with a slash.
   */
  public function getAliasByPath($path, $langcode = NULL);

  /**
   * Clears the static caches in alias manager and rebuilds the prefix list.
   *
   * @param string|null $source
   *   Source path of the alias that is being inserted/updated. If omitted, the
   *   entire lookup static cache will be cleared and the prefix list will be
   *   rebuilt.
   */
  public function cacheClear($source = NULL);

}