HttpRequest::send()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 4
Bugs 1 Features 0
Metric Value
c 4
b 1
f 0
dl 0
loc 7
ccs 4
cts 4
cp 1
rs 9.4286
cc 1
eloc 4
nc 1
nop 0
crap 1
1
<?php
2
/**
3
 * This file is part of the bee4/transport package.
4
 * For the full copyright and license information, please view the LICENSE
5
 * file that was distributed with this source code.
6
 *
7
 * @copyright Bee4 2015
8
 * @author  Stephane HULARD <[email protected]>
9
 * @package Bee4\Transport\Message\Request\Http
10
 */
11
12
namespace Bee4\Transport\Message\Request\Http;
13
14
use Bee4\Transport\Message\Request\AbstractRequest;
15
16
class HttpRequest extends AbstractRequest
17
{
18
    //1XX - Informational
19
    const STATUS_100 = "100 Continue";
20
    const STATUS_101 = "101 Switching Protocols";
21
    const STATUS_102 = "102 Processing (WebDAV; RFC 2518)";
22
    //2XX - Success
23
    const STATUS_200 = "200 OK";
24
    const STATUS_201 = "201 Created";
25
    const STATUS_202 = "202 Accepted";
26
    const STATUS_203 = "203 Non-Authoritative Information (since HTTP/1.1)";
27
    const STATUS_204 = "204 No Content";
28
    const STATUS_205 = "205 Reset Content";
29
    const STATUS_206 = "206 Partial Content";
30
    const STATUS_207 = "207 Multi-Status (WebDAV; RFC 4918)";
31
    const STATUS_208 = "208 Already Reported (WebDAV; RFC 5842)";
32
    const STATUS_226 = "226 IM Used (RFC 3229)";
33
    //3XX - Redirection
34
    const STATUS_300 = "300 Multiple Choices";
35
    const STATUS_301 = "301 Moved Permanently";
36
    const STATUS_302 = "302 Found";
37
    const STATUS_303 = "303 See Other (since HTTP/1.1)";
38
    const STATUS_304 = "304 Not Modified";
39
    const STATUS_305 = "305 Use Proxy (since HTTP/1.1)";
40
    const STATUS_306 = "306 Switch Proxy";
41
    const STATUS_307 = "307 Temporary Redirect (since HTTP/1.1)";
42
    const STATUS_308 = "308 Permanent Redirect (Experimental RFC; RFC 7238)";
43
    //4XX - Client error
44
    const STATUS_400 = "400 Bad Request";
45
    const STATUS_401 = "401 Unauthorized";
46
    const STATUS_402 = "402 Payment Required";
47
    const STATUS_403 = "403 Forbidden";
48
    const STATUS_404 = "404 Not Found";
49
    const STATUS_405 = "405 Method Not Allowed";
50
    const STATUS_406 = "406 Not Acceptable";
51
    const STATUS_407 = "407 Proxy Authentication Required";
52
    const STATUS_408 = "408 Request Timeout";
53
    const STATUS_409 = "409 Conflict";
54
    const STATUS_410 = "410 Gone";
55
    const STATUS_411 = "411 Length Required";
56
    const STATUS_412 = "412 Precondition Failed";
57
    const STATUS_413 = "413 Request Entity Too Large";
58
    const STATUS_414 = "414 Request-URI Too Long";
59
    const STATUS_415 = "415 Unsupported Media Type";
60
    const STATUS_416 = "416 Requested Range Not Satisfiable";
61
    const STATUS_417 = "417 Expectation Failed";
62
    const STATUS_418 = "418 I'm a teapot (RFC 2324)";
63
    const STATUS_422 = "422 Unprocessable Entity (WebDAV; RFC 4918)";
64
    const STATUS_423 = "423 Locked (WebDAV; RFC 4918)";
65
    const STATUS_424 = "424 Failed Dependency (WebDAV; RFC 4918)";
66
    const STATUS_426 = "426 Upgrade Required";
67
    const STATUS_428 = "428 Precondition Required (RFC 6585)";
68
    const STATUS_429 = "429 Too Many Requests (RFC 6585)";
69
    const STATUS_431 = "431 Request Header Fields Too Large (RFC 6585)";
70
    const STATUS_440 = "440 Login Timeout (Microsoft)";
71
    const STATUS_444 = "444 No Response (Nginx)";
72
    const STATUS_449 = "449 Retry With (Microsoft)";
73
    const STATUS_450 = "450 Blocked by Windows Parental Controls (Microsoft)";
74
    const STATUS_451 = "Unavailable For Legal Reasons (Internet draft)";
75
    const STATUS_494 = "494 Request Header Too Large (Nginx)";
76
    const STATUS_495 = "495 Cert Error (Nginx)";
77
    const STATUS_496 = "496 No Cert (Nginx)";
78
    const STATUS_497 = "497 HTTP to HTTPS (Nginx)";
79
    const STATUS_498 = "498 Token expired/invalid (Esri)";
80
    const STATUS_499 = "499 Client Closed Request (Nginx)";
81
    //5XX - Server Error
82
    const STATUS_500 = "500 Internal Server Error";
83
    const STATUS_501 = "501 Not Implemented";
84
    const STATUS_502 = "502 Bad Gateway";
85
    const STATUS_503 = "503 Service Unavailable";
86
    const STATUS_504 = "504 Gateway Timeout";
87
    const STATUS_505 = "505 HTTP Version Not Supported";
88
    const STATUS_506 = "506 Variant Also Negotiates (RFC 2295)";
89
    const STATUS_507 = "507 Insufficient Storage (WebDAV; RFC 4918)";
90
    const STATUS_508 = "508 Loop Detected (WebDAV; RFC 5842)";
91
    const STATUS_509 = "509 Bandwidth Limit Exceeded (Apache bw/limited extension)";
92
    const STATUS_510 = "510 Not Extended (RFC 2774)";
93
    const STATUS_511 = "511 Network Authentication Required (RFC 6585)";
94
95
    /**
96
     * Send the request and prepend some headers
97
     * @return \Bee4\Transport\Message\Response
98
     */
99 9
    public function send()
100
    {
101 9
        $this->addOption(CURLOPT_HTTPHEADER, $this->getHeaderLines());
102 9
        $this->addOption(CURLOPT_USERAGENT, $this->getUserAgent());
103
104 9
        return parent::send();
105
    }
106
107
    /**
108
     * Prepare the request execution by adding specific cURL parameters
109
     */
110
    protected function prepare()
111
    {
112
    }
113
}
114