AliasManagerInterface.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. namespace Drupal\Core\Path;
  3. /**
  4. * Find an alias for a path and vice versa.
  5. *
  6. * @see \Drupal\Core\Path\AliasStorageInterface
  7. */
  8. interface AliasManagerInterface {
  9. /**
  10. * Given the alias, return the path it represents.
  11. *
  12. * @param string $alias
  13. * An alias.
  14. * @param string $langcode
  15. * An optional language code to look up the path in.
  16. *
  17. * @return string
  18. * The path represented by alias, or the alias if no path was found.
  19. *
  20. * @throws \InvalidArgumentException
  21. * Thrown when the path does not start with a slash.
  22. */
  23. public function getPathByAlias($alias, $langcode = NULL);
  24. /**
  25. * Given a path, return the alias.
  26. *
  27. * @param string $path
  28. * A path.
  29. * @param string $langcode
  30. * An optional language code to look up the path in.
  31. *
  32. * @return string
  33. * An alias that represents the path, or path if no alias was found.
  34. *
  35. * @throws \InvalidArgumentException
  36. * Thrown when the path does not start with a slash.
  37. */
  38. public function getAliasByPath($path, $langcode = NULL);
  39. /**
  40. * Clear internal caches in alias manager.
  41. *
  42. * @param $source
  43. * Source path of the alias that is being inserted/updated. Can be omitted
  44. * if entire cache needs to be flushed.
  45. */
  46. public function cacheClear($source = NULL);
  47. }