. */ namespace SP\Domain\Http\Ports; use Klein\Request; use SP\Domain\Core\Exceptions\SPException; use SP\Domain\Http\Method; /** * Interface RequestService */ interface RequestService { public function getClientAddress(bool $fullForwarded = false): string; /** * @return string[]|null */ public function getForwardedFor(): ?array; /** * Comprobar si se realiza una recarga de la página */ public function checkReload(): bool; public function analyzeEmail(string $param, ?string $default = null): ?string; /** * Analizar un valor encriptado y devolverlo desencriptado */ public function analyzeEncrypted(string $param): string; public function analyzeString(string $param, ?string $default = null): ?string; public function analyzeUnsafeString(string $param, ?string $default = null): ?string; /** * @param string $param * @param callable|null $mapper * @param mixed $default * * @return array|null */ public function analyzeArray(string $param, ?callable $mapper = null, mixed $default = null): ?array; /** * Comprobar si la petición es en formato JSON */ public function isJson(): bool; /** * Comprobar si la petición es Ajax */ public function isAjax(): bool; public function analyzeInt(string $param, ?int $default = null): ?int; public function getFile(string $file): ?array; public function analyzeBool(string $param, ?bool $default = null): bool; /** * @param string $key * @param string|null $param Checks the signature only for the given param * * @throws SPException */ public function verifySignature(string $key, ?string $param = null): void; /** * Returns the URI used by the browser and checks for the protocol used * * @see https://tools.ietf.org/html/rfc7239#section-7.5 */ public function getHttpHost(): string; /** * Devolver datos de forward RFC 7239 * * @see https://tools.ietf.org/html/rfc7239#section-7.5 */ public function getForwardedData(): ?array; public function getHeader(string $header): string; /** * Devolver datos de x-forward */ public function getXForwardedData(): ?array; public function getMethod(): Method; public function isHttps(): ?bool; public function getServerPort(): int; public function getRequest(): Request; public function getServer(string $key): string; }