You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The simplest OOP-style wrapper for the standard php curl functions.
9
-
The main purpose is to make code that uses curl calls testable. We do it by injecting the Curl object as a dependency instead of calling curl functions directly.
7
+
The simplest OOP-style wrapper for the standard php curl functions with no external dependencies.
8
+
The main purpose is to make code that uses curl calls testable.
9
+
We do it by injecting the Curl object as a dependency instead of calling curl functions directly.
10
10
11
11
12
12
Hard-coded dependencies. Not testable.
@@ -52,7 +52,7 @@ Via [composer](https://getcomposer.org):
52
52
53
53
| Classic | OOP |
54
54
| --- | --- |
55
-
|`$h = curl_init($url)`|`$curl = new Curl($url)` or `$curl->init($url)`|
55
+
|`$h = curl_init($url)`|`$curl = new Curl(); $curl->init($url)`|
56
56
|`curl_close($h)`|`unset($curl)`|
57
57
|`$e = curl_errno($h)`|`$e = $curl->errno()`|
58
58
|`$e = curl_error($h)`|`$e = $curl->error()`|
@@ -71,7 +71,7 @@ Via [composer](https://getcomposer.org):
71
71
72
72
| Classic | OOP |
73
73
| --- | --- |
74
-
|`curl_multi_init()`|`$cm = new CurlMulti()`|
74
+
|`curl_multi_init()`|`$cm = new CurlMulti(); $cm->init()`|
0 commit comments