<?php
/**
* Port utilities for Requests
*
* @package Requests\Utilities
* @since 2.0.0
*/
namespace WpOrg\Requests;
use WpOrg\Requests\Exception;
use WpOrg\Requests\Exception\InvalidArgument;
/**
* Find the correct port depending on the Request type.
*
* @package Requests\Utilities
* @since 2.0.0
*/
final class Port {
/**
* Port to use with Acap requests.
*
* @var int
*/
const ACAP = 674;
/**
* Port to use with Dictionary requests.
*
* @var int
*/
const DICT = 2628;
/**
* Port to use with HTTP requests.
*
* @var int
*/
const HTTP = 80;
/**
* Port to use with HTTP over SSL requests.
*
* @var int
*/
const HTTPS = 443;
/**
* Retrieve the port number to use.
*
* @param string $type Request type.
* The following requests types are supported:
* 'acap', 'dict', 'http' and 'https'.
*
* @return int
*
* @throws \WpOrg\Requests\Exception\InvalidArgument When a non-string input has been passed.
* @throws \WpOrg\Requests\Exception When a non-supported port is requested ('portnotsupported').
*/
public static function get($type) {
if (!is_string($type)) {
throw InvalidArgument::create(1, '$type', 'string', gettype($type));
}
$type = strtoupper($type);
if (!defined("self::{$type}")) {
$message = sprintf('Invalid port type (%s) passed', $type);
throw new Exception($message, 'portnotsupported');
}
return constant("self::{$type}");
}
}
| nama | waktu | ukuran | owner | perm | aksi |
|---|---|---|---|---|---|
| .. | |||||
| Auth/ | 2026-02-23 19:41 | 2.48 KB | 76129f60960:kunden | dxwrx-rx-r | |
| Cookie/ | 2026-02-23 19:41 | 4.26 KB | 76129f60960:kunden | dxwrx-rx-r | |
| Exception/ | 2026-02-23 19:41 | 21.94 KB | 76129f60960:kunden | dxwrx-rx-r | |
| Proxy/ | 2026-02-23 19:41 | 4.12 KB | 76129f60960:kunden | dxwrx-rx-r | |
| Response/ | 2026-02-23 19:41 | 3.04 KB | 76129f60960:kunden | dxwrx-rx-r | |
| Transport/ | 2026-02-23 19:41 | 35.11 KB | 76129f60960:kunden | dxwrx-rx-r | |
| Utility/ | 2026-02-23 19:41 | 7.17 KB | 76129f60960:kunden | dxwrx-rx-r | |
| Auth.php | 2026-02-23 19:41 | 860 B | 76129f60960:kunden | -xw-x----- | |
| Autoload.php | 2026-02-23 19:41 | 9.12 KB | 76129f60960:kunden | -xw-x----- | |
| Capability.php | 2026-02-23 19:41 | 652 B | 76129f60960:kunden | -xw-x----- | |
| Cookie.php | 2026-02-23 19:41 | 15.03 KB | 76129f60960:kunden | -xw-x----- | |
| Exception.php | 2026-02-23 19:41 | 1.09 KB | 76129f60960:kunden | -xw-x----- | |
| HookManager.php | 2026-02-23 19:41 | 709 B | 76129f60960:kunden | -xw-x----- | |
| Hooks.php | 2026-02-23 19:41 | 2.96 KB | 76129f60960:kunden | -xw-x----- | |
| IdnaEncoder.php | 2026-05-21 09:11 | 12.16 KB | 76129f60960:kunden | -xw-x--x-- | |
| Ipv6.php | 2026-05-21 09:11 | 5.51 KB | 76129f60960:kunden | -xw-x--x-- | |
| Iri.php | 2026-05-21 09:11 | 29.03 KB | 76129f60960:kunden | -xw-x--x-- | |
| Port.php | 2026-02-23 19:41 | 1.47 KB | 76129f60960:kunden | -xw-x----- | |
| Proxy.php | 2026-02-23 19:41 | 867 B | 76129f60960:kunden | -xw-x----- | |
| Requests.php | 2026-05-21 09:11 | 33.2 KB | 76129f60960:kunden | -xw-x--x-- | |
| Response.php | 2026-02-23 19:41 | 4.18 KB | 76129f60960:kunden | -xw-x----- | |
| Session.php | 2026-02-23 19:41 | 8.89 KB | 76129f60960:kunden | -xw-x----- | |
| Ssl.php | 2026-02-23 19:41 | 5.3 KB | 76129f60960:kunden | -xw-x----- | |
| Transport.php | 2026-02-23 19:41 | 1.51 KB | 76129f60960:kunden | -xw-x----- | |