7
7
8
8
namespace Parse \HttpClients ;
9
9
10
-
11
10
use Parse \ParseException ;
12
11
13
12
/**
@@ -27,11 +26,9 @@ class ParseCurl
27
26
*/
28
27
public function init ()
29
28
{
30
- if ($ this ->curl === null ) {
29
+ if ($ this ->curl === null ) {
31
30
$ this ->curl = curl_init ();
32
-
33
31
}
34
-
35
32
}
36
33
37
34
/**
@@ -42,9 +39,8 @@ public function init()
42
39
*/
43
40
public function exec ()
44
41
{
45
- if (!isset ($ this ->curl )) {
42
+ if (!isset ($ this ->curl )) {
46
43
throw new ParseException ('You must call ParseCurl::init first ' );
47
-
48
44
}
49
45
50
46
return curl_exec ($ this ->curl );
@@ -59,13 +55,11 @@ public function exec()
59
55
*/
60
56
public function setOption ($ option , $ value )
61
57
{
62
- if (!isset ($ this ->curl )) {
58
+ if (!isset ($ this ->curl )) {
63
59
throw new ParseException ('You must call ParseCurl::init first ' );
64
-
65
60
}
66
61
67
62
curl_setopt ($ this ->curl , $ option , $ value );
68
-
69
63
}
70
64
71
65
/**
@@ -76,13 +70,11 @@ public function setOption($option, $value)
76
70
*/
77
71
public function setOptionsArray ($ options )
78
72
{
79
- if (!isset ($ this ->curl )) {
73
+ if (!isset ($ this ->curl )) {
80
74
throw new ParseException ('You must call ParseCurl::init first ' );
81
-
82
75
}
83
76
84
77
curl_setopt_array ($ this ->curl , $ options );
85
-
86
78
}
87
79
88
80
/**
@@ -94,13 +86,11 @@ public function setOptionsArray($options)
94
86
*/
95
87
public function getInfo ($ info )
96
88
{
97
- if (!isset ($ this ->curl )) {
89
+ if (!isset ($ this ->curl )) {
98
90
throw new ParseException ('You must call ParseCurl::init first ' );
99
-
100
91
}
101
92
102
93
return curl_getinfo ($ this ->curl , $ info );
103
-
104
94
}
105
95
106
96
/**
@@ -111,13 +101,11 @@ public function getInfo($info)
111
101
*/
112
102
public function getError ()
113
103
{
114
- if (!isset ($ this ->curl )) {
104
+ if (!isset ($ this ->curl )) {
115
105
throw new ParseException ('You must call ParseCurl::init first ' );
116
-
117
106
}
118
107
119
108
return curl_error ($ this ->curl );
120
-
121
109
}
122
110
123
111
/**
@@ -128,31 +116,26 @@ public function getError()
128
116
*/
129
117
public function getErrorCode ()
130
118
{
131
- if (!isset ($ this ->curl )) {
119
+ if (!isset ($ this ->curl )) {
132
120
throw new ParseException ('You must call ParseCurl::init first ' );
133
-
134
121
}
135
122
136
123
return curl_errno ($ this ->curl );
137
-
138
124
}
139
125
140
126
/**
141
127
* Closed our curl handle and disposes of it
142
128
*/
143
129
public function close ()
144
130
{
145
- if (!isset ($ this ->curl )) {
131
+ if (!isset ($ this ->curl )) {
146
132
throw new ParseException ('You must call ParseCurl::init first ' );
147
-
148
133
}
149
134
150
135
// close our handle
151
136
curl_close ($ this ->curl );
152
137
153
138
// unset our curl handle
154
139
$ this ->curl = null ;
155
-
156
140
}
157
-
158
- }
141
+ }
0 commit comments