MatcherInterface.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <?php
  2. namespace Drupal\linkit;
  3. use Drupal\Component\Plugin\ConfigurablePluginInterface;
  4. use Drupal\Component\Plugin\PluginInspectionInterface;
  5. /**
  6. * Defines the interface for matchers.
  7. *
  8. * @see \Drupal\linkit\Annotation\Matcher
  9. * @see \Drupal\linkit\MatcherBase
  10. * @see \Drupal\linkit\MatcherManager
  11. * @see plugin_api
  12. */
  13. interface MatcherInterface extends PluginInspectionInterface, ConfigurablePluginInterface {
  14. /**
  15. * Returns the unique ID representing the matcher.
  16. *
  17. * @return string
  18. * The matcher ID.
  19. */
  20. public function getUuid();
  21. /**
  22. * Returns the matcher label.
  23. *
  24. * @return string
  25. * The matcher label.
  26. */
  27. public function getLabel();
  28. /**
  29. * Returns the summarized configuration of the matcher.
  30. *
  31. * @return array
  32. * An array of summarized configuration of the matcher.
  33. */
  34. public function getSummary();
  35. /**
  36. * Returns the weight of the matcher.
  37. *
  38. * @return int|string
  39. * Either the integer weight of the matcher, or an empty string.
  40. */
  41. public function getWeight();
  42. /**
  43. * Sets the weight for the matcher.
  44. *
  45. * @param int $weight
  46. * The weight for this matcher.
  47. *
  48. * @return $this
  49. */
  50. public function setWeight($weight);
  51. /**
  52. * Executes the matcher.
  53. *
  54. * @param string $string
  55. * The string that contains the text to search for.
  56. *
  57. * @return \Drupal\linkit\Suggestion\SuggestionCollection
  58. * A suggestion collection.
  59. */
  60. public function execute($string);
  61. }