TrustedCallbackInterface.php 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. namespace Drupal\Core\Security;
  3. /**
  4. * Interface to declare trusted callbacks.
  5. *
  6. * @see \Drupal\Core\Security\DoTrustedCallbackTrait
  7. */
  8. interface TrustedCallbackInterface {
  9. /**
  10. * Untrusted callbacks throw exceptions.
  11. */
  12. const THROW_EXCEPTION = 'exception';
  13. /**
  14. * Untrusted callbacks trigger E_USER_WARNING errors.
  15. */
  16. const TRIGGER_WARNING = 'warning';
  17. /**
  18. * Untrusted callbacks trigger silenced E_USER_DEPRECATION errors.
  19. */
  20. const TRIGGER_SILENCED_DEPRECATION = 'silenced_deprecation';
  21. /**
  22. * Lists the trusted callbacks provided by the implementing class.
  23. *
  24. * Trusted callbacks are public methods on the implementing class and can be
  25. * invoked via
  26. * \Drupal\Core\Security\DoTrustedCallbackTrait::doTrustedCallback().
  27. *
  28. * @return string[]
  29. * List of method names implemented by the class that can be used as trusted
  30. * callbacks.
  31. *
  32. * @see \Drupal\Core\Security\DoTrustedCallbackTrait::doTrustedCallback()
  33. */
  34. public static function trustedCallbacks();
  35. }