Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
n/a
0 / 0
n/a
0 / 0
CRAP
n/a
0 / 0
1<?php
2declare(strict_types=1);
3/**
4 * Pop PHP Framework (https://www.popphp.org/)
5 *
6 * @link       https://github.com/popphp/popphp-framework
7 * @author     Nick Sagona, III <nick@popphp.org>
8 * @copyright  Copyright (c) 2009-2026 Nick Sagona, III
9 * @license    https://www.popphp.org/license     New BSD License
10 */
11
12/**
13 * @namespace
14 */
15namespace Pop\Http\Client\Handler;
16
17use Pop\Http\Auth;
18use Pop\Http\Client\Request;
19use Pop\Http\Client\Response;
20use Pop\Http\Uri;
21
22/**
23 * HTTP client handler interface
24 *
25 * @category   Pop
26 * @package    Pop\Http
27 * @author     Nick Sagona, III <nick@popphp.org>
28 * @copyright  Copyright (c) 2009-2026 Nick Sagona, III
29 * @license    https://www.popphp.org/license     New BSD License
30 * @version    6.0.0
31 */
32interface HandlerInterface
33{
34
35    /**
36     * Determine whether or not resource is available
37     *
38     * @return bool
39     */
40    public function hasResource(): bool;
41
42    /**
43     * Get the resource
44     *
45     * @return mixed
46     */
47    public function getResource(): mixed;
48
49    /**
50     * Get the resource (alias method)
51     *
52     * @return mixed
53     */
54    public function resource(): mixed;
55
56    /**
57     * Get the HTTP version
58     *
59     * @return string
60     */
61    public function getHttpVersion(): string;
62
63    /**
64     * Get the URI as an object
65     *
66     * @return Uri
67     */
68    public function getUriObject(): Uri;
69
70    /**
71     * Method to send the request
72     */
73    public function send();
74
75    /**
76     * Method to reset the handler
77     *
78     * @return HandlerInterface
79     */
80    public function reset(): HandlerInterface;
81
82    /**
83     * Prepare the handler with the given request (and optional auth) before sending
84     *
85     * @param  Request         $request
86     * @param  ?\Pop\Http\Auth $auth
87     * @return HandlerInterface
88     */
89    public function prepare(Request $request, ?\Pop\Http\Auth $auth = null): HandlerInterface;
90
91    /**
92     * Close the handler connection
93     *
94     * @return void
95     */
96    public function disconnect(): void;
97
98}