PathInterface.php 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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 League\Uri\Exceptions\SyntaxError;
  13. interface PathInterface extends UriComponentInterface
  14. {
  15. /**
  16. * Returns the decoded path.
  17. */
  18. public function decoded(): string;
  19. /**
  20. * Tells whether the path is absolute or relative.
  21. */
  22. public function isAbsolute(): bool;
  23. /**
  24. * Tells whether the path has a trailing slash.
  25. */
  26. public function hasTrailingSlash(): bool;
  27. /**
  28. * Returns an instance without dot segments.
  29. *
  30. * This method MUST retain the state of the current instance, and return
  31. * an instance that contains the path component normalized by removing
  32. * the dot segment.
  33. *
  34. * @throws SyntaxError for invalid component or transformations
  35. * that would result in a object in invalid state.
  36. */
  37. public function withoutDotSegments(): self;
  38. /**
  39. * Returns an instance with a leading slash.
  40. *
  41. * This method MUST retain the state of the current instance, and return
  42. * an instance that contains the path component with a leading slash
  43. *
  44. * @throws SyntaxError for invalid component or transformations
  45. * that would result in a object in invalid state.
  46. */
  47. public function withLeadingSlash(): self;
  48. /**
  49. * Returns an instance without a leading slash.
  50. *
  51. * This method MUST retain the state of the current instance, and return
  52. * an instance that contains the path component without a leading slash
  53. *
  54. * @throws SyntaxError for invalid component or transformations
  55. * that would result in a object in invalid state.
  56. */
  57. public function withoutLeadingSlash(): self;
  58. /**
  59. * Returns an instance with a trailing slash.
  60. *
  61. * This method MUST retain the state of the current instance, and return
  62. * an instance that contains the path component with a trailing slash
  63. *
  64. * @throws SyntaxError for invalid component or transformations
  65. * that would result in a object in invalid state.
  66. */
  67. public function withTrailingSlash(): self;
  68. /**
  69. * Returns an instance without a trailing slash.
  70. *
  71. * This method MUST retain the state of the current instance, and return
  72. * an instance that contains the path component without a trailing slash
  73. *
  74. * @throws SyntaxError for invalid component or transformations
  75. * that would result in a object in invalid state.
  76. */
  77. public function withoutTrailingSlash(): self;
  78. }