diff --git a/Contracts/UriInterface.php b/Contracts/UriInterface.php index 0cfafe7..4d60fea 100644 --- a/Contracts/UriInterface.php +++ b/Contracts/UriInterface.php @@ -24,15 +24,12 @@ * * @method string|null getUsername() returns the user component of the URI. * @method string|null getPassword() returns the scheme-specific information about how to gain authorization to access the resource. - * @method string|null toUnixPath() returns the Unix filesystem path. The method returns null for any other scheme - * @method string|null toWindowsPath() returns the Windows filesystem path. The method returns null for any other scheme - * @method string|null toRfc8089() returns a string representation of a File URI according to RFC8089. The method returns null for any other scheme + * @method string|null getOrigin() returns the URI origin as described in the WHATWG URL Living standard specification * @method string toNormalizedString() returns the normalized string representation of the URI * @method array toComponents() returns an associative array containing all the URI components. * @method self normalize() returns a new URI instance with normalized components * @method self resolve(UriInterface $uri) resolves a URI against a base URI using RFC3986 rules * @method self relativize(UriInterface $uri) relativize a URI against a base URI using RFC3986 rules - * @method self|null getOrigin() returns the URI origin as described in the WHATWG URL Living standard specification * @method bool isOpaque() tells whether the given URI object represents an opaque URI. * @method bool isAbsolute() tells whether the URI represents an absolute URI. * @method bool isNetworkPath() tells whether the URI represents a network path URI. diff --git a/Contracts/UriStringProvider.php b/Contracts/UriStringProvider.php new file mode 100644 index 0000000..1ded31f --- /dev/null +++ b/Contracts/UriStringProvider.php @@ -0,0 +1,71 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace League\Uri\Contracts; + +use DOMException; +use JsonSerializable; + +interface UriStringProvider extends JsonSerializable +{ + /** + * Returns the string representation as a URI reference. + * + * @see http://tools.ietf.org/html/rfc3986#section-4.1 + */ + public function toString(): string; + + /** + * Returns the normalized string representation of the URI. + * + * @see https://datatracker.ietf.org/doc/html/rfc3986#section-6.2 + */ + public function toNormalizedString(): ?string; + + /** + * Returns the human-readable string representation of the URI. + * + * @see https://datatracker.ietf.org/doc/html/rfc3986#section-6.2 + */ + public function toDisplayString(): ?string; + + /** + * Returns the string representation as a URI reference. + * + * @see http://tools.ietf.org/html/rfc3986#section-4.1 + * @see ::__toString + */ + public function jsonSerialize(): string; + + /** + * Returns the HTML string representation of the anchor tag with the current instance as its href attribute. + * + * @throws DOMException + */ + public function toAnchorTag(?string $content = null, ?string $class = null, ?string $target = null): string; + + /** + * Returns the markdown string representation of the anchor tag with the current instance as its href attribute. + */ + public function toMarkdown(?string $content = null): string; + + /** + * Returns the Unix filesystem path. The method returns null for any other scheme. + */ + public function toUnixPath(): ?string; + + /** + * Returns the Windows filesystem path. The method returns null for any other scheme. + */ + public function toWindowsPath(): ?string; +}