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
2
3/**
4 * VuFind HTTP service interface definition.
5 *
6 * PHP version 7
7 *
8 * Copyright (C) Villanova University 2010.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2,
12 * as published by the Free Software Foundation.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
22 *
23 * @category VuFind
24 * @package  Http
25 * @author   David Maus <maus@hab.de>
26 * @license  http://opensource.org/licenses/gpl-2.0.php GNU General Public License
27 * @link     https://vufind.org/wiki/development
28 */
29
30namespace VuFindHttp;
31
32/**
33 * VuFind HTTP service interface definition.
34 *
35 * @category VuFind
36 * @package  Http
37 * @author   David Maus <maus@hab.de>
38 * @license  http://opensource.org/licenses/gpl-2.0.php GNU General Public License
39 * @link     https://vufind.org/wiki/development
40 */
41interface HttpServiceInterface
42{
43    /**
44     * Proxify an existing client.
45     *
46     * Returns the client given as argument with appropriate proxy setup.
47     *
48     * @param \Laminas\Http\Client $client  HTTP client
49     * @param array                $options ZF2 ProxyAdapter options
50     *
51     * @return \Laminas\Http\Client
52     */
53    public function proxify(\Laminas\Http\Client $client, array $options = []);
54
55    /**
56     * Perform a GET request.
57     *
58     * @param string $url     Request URL
59     * @param array  $params  Request parameters
60     * @param float  $timeout Request timeout in seconds
61     * @param array  $headers Request headers
62     *
63     * @return \Laminas\Http\Response
64     */
65    public function get(
66        $url,
67        array $params = [],
68        $timeout = null,
69        array $headers = []
70    );
71
72    /**
73     * Perform a POST request.
74     *
75     * @param string $url     Request URL
76     * @param mixed  $body    Request body document
77     * @param string $type    Request body content type
78     * @param float  $timeout Request timeout in seconds
79     * @param array  $headers Request http-headers
80     *
81     * @return \Laminas\Http\Response
82     */
83    public function post(
84        $url,
85        $body = null,
86        $type = 'application/octet-stream',
87        $timeout = null,
88        array $headers = []
89    );
90
91    /**
92     * Post form data.
93     *
94     * @param string $url     Request URL
95     * @param array  $params  Form data
96     * @param float  $timeout Request timeout in seconds
97     *
98     * @return \Laminas\Http\Response
99     */
100    public function postForm($url, array $params = [], $timeout = null);
101
102    /**
103     * Return a new proxy client.
104     *
105     * @param string $url     Target URL
106     * @param string $method  Request method
107     * @param float  $timeout Request timeout in seconds
108     *
109     * @return \Laminas\Http\Client
110     */
111    public function createClient(
112        $url = null,
113        $method = \Laminas\Http\Request::METHOD_GET,
114        $timeout = null
115    );
116}