| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* League.Uri (https://uri.thephpleague.com) |
| 5 |
* |
| 6 |
* (c) Ignace Nyamagana Butera <[email protected]> |
| 7 |
* |
| 8 |
* For the full copyright and license information, please view the LICENSE |
| 9 |
* file that was distributed with this source code. |
| 10 |
*/ |
| 11 |
|
| 12 |
declare(strict_types=1); |
| 13 |
|
| 14 |
namespace WP_DEFENDER_VENDOR\League\Uri\Contracts; |
| 15 |
|
| 16 |
use WP_DEFENDER_VENDOR\League\Uri\Exceptions\SyntaxError; |
| 17 |
|
| 18 |
/** |
| 19 |
* @extends \IteratorAggregate<string> |
| 20 |
*/ |
| 21 |
interface DomainHostInterface extends \Countable, HostInterface, \IteratorAggregate |
| 22 |
{ |
| 23 |
/** |
| 24 |
* Returns the labels total number. |
| 25 |
*/ |
| 26 |
public function count(): int; |
| 27 |
|
| 28 |
/** |
| 29 |
* Iterate over the Domain labels. |
| 30 |
* |
| 31 |
* @return \Iterator<string> |
| 32 |
*/ |
| 33 |
public function getIterator(): \Iterator; |
| 34 |
|
| 35 |
/** |
| 36 |
* Retrieves a single host label. |
| 37 |
* |
| 38 |
* If the label offset has not been set, returns the null value. |
| 39 |
*/ |
| 40 |
public function get(int $offset): ?string; |
| 41 |
|
| 42 |
/** |
| 43 |
* Returns the associated key for a specific label or all the keys. |
| 44 |
* |
| 45 |
* @param ?string $label |
| 46 |
* |
| 47 |
* @return int[] |
| 48 |
*/ |
| 49 |
public function keys(?string $label = null): array; |
| 50 |
|
| 51 |
/** |
| 52 |
* Tells whether the domain is absolute. |
| 53 |
*/ |
| 54 |
public function isAbsolute(): bool; |
| 55 |
|
| 56 |
/** |
| 57 |
* Prepends a label to the host. |
| 58 |
*/ |
| 59 |
public function prepend(string $label): self; |
| 60 |
|
| 61 |
/** |
| 62 |
* Appends a label to the host. |
| 63 |
*/ |
| 64 |
public function append(string $label): self; |
| 65 |
|
| 66 |
/** |
| 67 |
* Returns an instance with its Root label. |
| 68 |
* |
| 69 |
* @see https://tools.ietf.org/html/rfc3986#section-3.2.2 |
| 70 |
*/ |
| 71 |
public function withRootLabel(): self; |
| 72 |
|
| 73 |
/** |
| 74 |
* Returns an instance without its Root label. |
| 75 |
* |
| 76 |
* @see https://tools.ietf.org/html/rfc3986#section-3.2.2 |
| 77 |
*/ |
| 78 |
public function withoutRootLabel(): self; |
| 79 |
|
| 80 |
/** |
| 81 |
* Returns an instance with the modified label. |
| 82 |
* |
| 83 |
* This method MUST retain the state of the current instance, and return |
| 84 |
* an instance that contains the new label |
| 85 |
* |
| 86 |
* If $key is non-negative, the added label will be the label at $key position from the start. |
| 87 |
* If $key is negative, the added label will be the label at $key position from the end. |
| 88 |
* |
| 89 |
* @throws SyntaxError If the key is invalid |
| 90 |
*/ |
| 91 |
public function withLabel(int $key, string $label): self; |
| 92 |
|
| 93 |
/** |
| 94 |
* Returns an instance without the specified label. |
| 95 |
* |
| 96 |
* This method MUST retain the state of the current instance, and return |
| 97 |
* an instance that contains the modified component |
| 98 |
* |
| 99 |
* If $key is non-negative, the removed label will be the label at $key position from the start. |
| 100 |
* If $key is negative, the removed label will be the label at $key position from the end. |
| 101 |
* |
| 102 |
* @param int ...$keys |
| 103 |
* |
| 104 |
* @throws SyntaxError If the key is invalid |
| 105 |
*/ |
| 106 |
public function withoutLabel(int ...$keys): self; |
| 107 |
} |
| 108 |
|