-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
162 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
<?php | ||
|
||
/** | ||
* League.Uri (https://uri.thephpleague.com) | ||
* | ||
* (c) Ignace Nyamagana Butera <[email protected]> | ||
* | ||
* 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; | ||
use League\Uri\UriString; | ||
|
||
/** | ||
* @phpstan-import-type ComponentMap from UriString | ||
*/ | ||
interface UriEncoder 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. | ||
* | ||
* @param list<string>|string|null $class | ||
* | ||
* @throws DOMException | ||
*/ | ||
public function toAnchorTag(?string $linkText = null, array|string|null $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 $linkText = null): string; | ||
|
||
/** | ||
* Returns the Unix filesystem path. The method returns null for any other scheme except the file scheme. | ||
*/ | ||
public function toUnixPath(): ?string; | ||
|
||
/** | ||
* Returns the Windows filesystem path. The method returns null for any other scheme except the file scheme. | ||
*/ | ||
public function toWindowsPath(): ?string; | ||
|
||
/** | ||
* Returns an associative array containing all the URI components. | ||
* | ||
* @return ComponentMap | ||
*/ | ||
public function toComponents(): array; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
<?php | ||
|
||
/** | ||
* League.Uri (https://uri.thephpleague.com) | ||
* | ||
* (c) Ignace Nyamagana Butera <[email protected]> | ||
* | ||
* 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; | ||
|
||
interface UriInspector | ||
{ | ||
/** | ||
* Tells whether the URI instance represents an opaque URI. | ||
*/ | ||
public function isOpaque(): bool; | ||
|
||
/** | ||
* Tells whether the URI represents an absolute URI. | ||
*/ | ||
public function isAbsolute(): bool; | ||
|
||
/** | ||
* Tells whether the URI represents a network path URI. | ||
*/ | ||
public function isNetworkPath(): bool; | ||
|
||
/** | ||
* Tells whether the URI represents an absolute URI path. | ||
*/ | ||
public function isAbsolutePath(): bool; | ||
|
||
/** | ||
* Tells whether the given URI object represents a relative path. | ||
*/ | ||
public function isRelativePath(): bool; | ||
|
||
/** | ||
* Tells whether the given URI object represents the same document. | ||
* | ||
* It never takes the fragment into account | ||
*/ | ||
public function isSameDocument(UriInterface $uri): bool; | ||
|
||
/** | ||
* Tells whether the given URI object represents the same document. | ||
* | ||
* It can take the fragment into account if it is explicitly specified | ||
*/ | ||
public function equals(UriInterface $uri, bool $excludeFragment): bool; | ||
|
||
/** | ||
* Tells whether the `file` scheme base URI represents a local file. | ||
*/ | ||
public function isLocalFile(): bool; | ||
|
||
/** | ||
* Tells whether the URI comes from a different origin than the current instance. | ||
*/ | ||
public function isCrossOrigin(UriInterface $uri): bool; | ||
|
||
/** | ||
* Tells whether the URI shares the same origin as the current instance. | ||
*/ | ||
public function isSameOrigin(UriInterface $uri): bool; | ||
|
||
/** | ||
* Returns the URI origin as described in the WHATWG URL Living standard specification. | ||
*/ | ||
public function getOrigin(): ?string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters