77
88namespace Parse \HttpClients ;
99
10-
1110use Parse \ParseException ;
1211
1312/**
@@ -27,11 +26,9 @@ class ParseCurl
2726 */
2827 public function init ()
2928 {
30- if ($ this ->curl === null ) {
29+ if ($ this ->curl === null ) {
3130 $ this ->curl = curl_init ();
32-
3331 }
34-
3532 }
3633
3734 /**
@@ -42,9 +39,8 @@ public function init()
4239 */
4340 public function exec ()
4441 {
45- if (!isset ($ this ->curl )) {
42+ if (!isset ($ this ->curl )) {
4643 throw new ParseException ('You must call ParseCurl::init first ' );
47-
4844 }
4945
5046 return curl_exec ($ this ->curl );
@@ -59,13 +55,11 @@ public function exec()
5955 */
6056 public function setOption ($ option , $ value )
6157 {
62- if (!isset ($ this ->curl )) {
58+ if (!isset ($ this ->curl )) {
6359 throw new ParseException ('You must call ParseCurl::init first ' );
64-
6560 }
6661
6762 curl_setopt ($ this ->curl , $ option , $ value );
68-
6963 }
7064
7165 /**
@@ -76,13 +70,11 @@ public function setOption($option, $value)
7670 */
7771 public function setOptionsArray ($ options )
7872 {
79- if (!isset ($ this ->curl )) {
73+ if (!isset ($ this ->curl )) {
8074 throw new ParseException ('You must call ParseCurl::init first ' );
81-
8275 }
8376
8477 curl_setopt_array ($ this ->curl , $ options );
85-
8678 }
8779
8880 /**
@@ -94,13 +86,11 @@ public function setOptionsArray($options)
9486 */
9587 public function getInfo ($ info )
9688 {
97- if (!isset ($ this ->curl )) {
89+ if (!isset ($ this ->curl )) {
9890 throw new ParseException ('You must call ParseCurl::init first ' );
99-
10091 }
10192
10293 return curl_getinfo ($ this ->curl , $ info );
103-
10494 }
10595
10696 /**
@@ -111,13 +101,11 @@ public function getInfo($info)
111101 */
112102 public function getError ()
113103 {
114- if (!isset ($ this ->curl )) {
104+ if (!isset ($ this ->curl )) {
115105 throw new ParseException ('You must call ParseCurl::init first ' );
116-
117106 }
118107
119108 return curl_error ($ this ->curl );
120-
121109 }
122110
123111 /**
@@ -128,31 +116,26 @@ public function getError()
128116 */
129117 public function getErrorCode ()
130118 {
131- if (!isset ($ this ->curl )) {
119+ if (!isset ($ this ->curl )) {
132120 throw new ParseException ('You must call ParseCurl::init first ' );
133-
134121 }
135122
136123 return curl_errno ($ this ->curl );
137-
138124 }
139125
140126 /**
141127 * Closed our curl handle and disposes of it
142128 */
143129 public function close ()
144130 {
145- if (!isset ($ this ->curl )) {
131+ if (!isset ($ this ->curl )) {
146132 throw new ParseException ('You must call ParseCurl::init first ' );
147-
148133 }
149134
150135 // close our handle
151136 curl_close ($ this ->curl );
152137
153138 // unset our curl handle
154139 $ this ->curl = null ;
155-
156140 }
157-
158- }
141+ }
0 commit comments