Completed
Pull Request — master (#17)
by Alexander
06:45
created

CurlFailure::setContext()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace alkemann\h2l\exceptions;
4
5
class CurlFailure extends \Exception
6
{
7
    protected $context = [];
8
9
    /**
10
     * @return array
11
     */
12
    public function getContext(): array
13
    {
14
        return $this->context;
15
    }
16
17
    /**
18
     * @param array $context
19
     */
20
    public function setContext(array $context)
21
    {
22
        $this->context = $context;
23
    }
24
25
    public static $code_to_constant_name = [
26
        1 => "CURLE_UNSUPPORTED_PROTOCOL",
27
        2 => "CURLE_FAILED_INIT",
28
        3 => "CURLE_URL_MALFORMAT",
29
        4 => "CURLE_URL_MALFORMAT_USER",
30
        5 => "CURLE_COULDNT_RESOLVE_PROXY",
31
        6 => "CURLE_COULDNT_RESOLVE_HOST",
32
        7 => "CURLE_COULDNT_CONNECT",
33
        8 => "CURLE_FTP_WEIRD_SERVER_REPLY",
34
        9 => "CURLE_FTP_ACCESS_DENIED",
35
        10 => "CURLE_FTP_USER_PASSWORD_INCORRECT",
36
        11 => "CURLE_FTP_WEIRD_PASS_REPLY",
37
        12 => "CURLE_FTP_WEIRD_USER_REPLY",
38
        13 => "CURLE_FTP_WEIRD_PASV_REPLY",
39
        14 => "CURLE_FTP_WEIRD_227_FORMAT",
40
        15 => "CURLE_FTP_CANT_GET_HOST",
41
        16 => "CURLE_FTP_CANT_RECONNECT",
42
        17 => "CURLE_FTP_COULDNT_SET_BINARY",
43
        // 18 => "CURLE_FTP_PARTIAL_FILE",
1 ignored issue
show
Unused Code Comprehensibility introduced by
58% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
44
        18 => "CURLE_PARTIAL_FILE",
45
        19 => "CURLE_FTP_COULDNT_RETR_FILE",
46
        20 => "CURLE_FTP_WRITE_ERROR",
47
        21 => "CURLE_FTP_QUOTE_ERROR",
48
        22 => "CURLE_HTTP_NOT_FOUND",
49
        // 22 => "CURLE_HTTP_RETURNED_ERROR",
1 ignored issue
show
Unused Code Comprehensibility introduced by
58% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
50
        23 => "CURLE_WRITE_ERROR",
51
        24 => "CURLE_MALFORMAT_USER",
52
        25 => "CURLE_FTP_COULDNT_STOR_FILE",
53
        26 => "CURLE_READ_ERROR",
54
        27 => "CURLE_OUT_OF_MEMORY",
55
        28 => "CURLE_OPERATION_TIMEDOUT",
56
        // 28 => "CURLE_OPERATION_TIMEOUTED",
1 ignored issue
show
Unused Code Comprehensibility introduced by
58% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
57
        29 => "CURLE_FTP_COULDNT_SET_ASCII",
58
        30 => "CURLE_FTP_PORT_FAILED",
59
        31 => "CURLE_FTP_COULDNT_USE_REST",
60
        32 => "CURLE_FTP_COULDNT_GET_SIZE",
61
        33 => "CURLE_HTTP_RANGE_ERROR",
62
        34 => "CURLE_HTTP_POST_ERROR",
63
        35 => "CURLE_SSL_CONNECT_ERROR",
64
        36 => "CURLE_BAD_DOWNLOAD_RESUME",
65
        // 36 => "CURLE_FTP_BAD_DOWNLOAD_RESUME",
1 ignored issue
show
Unused Code Comprehensibility introduced by
58% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
66
        37 => "CURLE_FILE_COULDNT_READ_FILE",
67
        38 => "CURLE_LDAP_CANNOT_BIND",
68
        39 => "CURLE_LDAP_SEARCH_FAILED",
69
        40 => "CURLE_LIBRARY_NOT_FOUND",
70
        41 => "CURLE_FUNCTION_NOT_FOUND",
71
        42 => "CURLE_ABORTED_BY_CALLBACK",
72
        43 => "CURLE_BAD_FUNCTION_ARGUMENT",
73
        44 => "CURLE_BAD_CALLING_ORDER",
74
        45 => "CURLE_HTTP_PORT_FAILED",
75
        46 => "CURLE_BAD_PASSWORD_ENTERED",
76
        47 => "CURLE_TOO_MANY_REDIRECTS",
77
        48 => "CURLE_UNKNOWN_TELNET_OPTION",
78
        49 => "CURLE_TELNET_OPTION_SYNTAX",
79
        50 => "CURLE_OBSOLETE",
80
        51 => "CURLE_SSL_PEER_CERTIFICATE",
81
        52 => "CURLE_GOT_NOTHING",
82
        53 => "CURLE_SSL_ENGINE_NOTFOUND",
83
        54 => "CURLE_SSL_ENGINE_SETFAILED",
84
        55 => "CURLE_SEND_ERROR",
85
        56 => "CURLE_RECV_ERROR",
86
        57 => "CURLE_SHARE_IN_USE",
87
        58 => "CURLE_SSL_CERTPROBLEM",
88
        59 => "CURLE_SSL_CIPHER",
89
        60 => "CURLE_SSL_CACERT",
90
        61 => "CURLE_BAD_CONTENT_ENCODING",
91
        62 => "CURLE_LDAP_INVALID_URL",
92
        63 => "CURLE_FILESIZE_EXCEEDED",
93
        64 => "CURLE_FTP_SSL_FAILED",
94
        79 => "CURLE_SSH"
95
    ];
96
}
97