FragmentDirective.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. /**
  3. * League.Uri (https://uri.thephpleague.com)
  4. *
  5. * (c) Ignace Nyamagana Butera <nyamsprod@gmail.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. declare(strict_types=1);
  11. namespace League\Uri\Contracts;
  12. use Stringable;
  13. /**
  14. * @see https://wicg.github.io/scroll-to-text-fragment/#the-fragment-directive
  15. *
  16. * @method string toFragmentValue() returns the encoded string representation of the directive as a fragment string
  17. */
  18. interface FragmentDirective extends Stringable
  19. {
  20. /**
  21. * The decoded Directive name.
  22. *
  23. * @return non-empty-string
  24. */
  25. public function name(): string;
  26. /**
  27. * The decoded Directive value.
  28. */
  29. public function value(): ?string;
  30. /**
  31. * The encoded string representation of the directive.
  32. */
  33. public function toString(): string;
  34. /**
  35. * The encoded string representation of the fragment using
  36. * the Stringable interface.
  37. *
  38. * @see FragmentDirective::toString()
  39. */
  40. public function __toString(): string;
  41. /**
  42. * Tells whether the submitted value is equals to the string
  43. * representation of the given directive.
  44. */
  45. public function equals(mixed $directive): bool;
  46. }