Skip to content

Commit a3694a4

Browse files
committed
The requestResolver options changed to camelCase
for more consistency with the rest of the options
1 parent 400133b commit a3694a4

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

Embed/RequestResolvers/Curl.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ class Curl implements RequestResolverInterface
1111
protected $result;
1212
protected $url;
1313
protected $config = array(
14-
'user_agent' => 'Embed PHP Library',
15-
'max_redirections' => 20,
16-
'connection_timeout' => 10,
14+
'userAgent' => 'Embed PHP Library',
15+
'maxRedirections' => 20,
16+
'connectionTimeout' => 10,
1717
'timeout' => 10,
1818
);
1919

@@ -144,16 +144,16 @@ protected function resolve()
144144
CURLOPT_URL => $this->url,
145145
CURLOPT_RETURNTRANSFER => true,
146146
CURLOPT_FOLLOWLOCATION => true,
147-
CURLOPT_MAXREDIRS => $this->config['max_redirections'],
148-
CURLOPT_CONNECTTIMEOUT => $this->config['connection_timeout'],
147+
CURLOPT_MAXREDIRS => $this->config['maxRedirections'],
148+
CURLOPT_CONNECTTIMEOUT => $this->config['connectionTimeout'],
149149
CURLOPT_TIMEOUT => $this->config['timeout'],
150150
CURLOPT_SSL_VERIFYPEER => false,
151151
CURLOPT_SSL_VERIFYHOST => false,
152152
CURLOPT_ENCODING => '',
153153
CURLOPT_AUTOREFERER => true,
154154
CURLOPT_COOKIEJAR => $tmpCookies,
155155
CURLOPT_COOKIEFILE => $tmpCookies,
156-
CURLOPT_USERAGENT => $this->config['user_agent']
156+
CURLOPT_USERAGENT => $this->config['userAgent']
157157
));
158158

159159
$this->content = '';

README.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -81,26 +81,26 @@ Embed\Request::setDefaultResolver('MyCustomResolverClass');
8181

8282
You can configure also the following options of the default request resolver:
8383

84-
* user_agent: User agent used in all requests. By default is "Embed PHP Library"
85-
* max_redirections: The maximum amount of HTTP redirections to follow. By default is 20
86-
* connection_timeout: The number of seconds to wait while trying to connect. Use 0 to wait indefinitely. By default is 10
84+
* userAgent: User agent used in all requests. By default is "Embed PHP Library"
85+
* maxRedirections: The maximum amount of HTTP redirections to follow. By default is 20
86+
* connectionTimeout: The number of seconds to wait while trying to connect. Use 0 to wait indefinitely. By default is 10
8787
* timeout: The maximum number of seconds to allow execute the request. By default is 10
8888

8989
To set a new configuration:
9090

9191
```php
9292
Embed\Request::setResolverConfig(array(
93-
'user_agent' => 'My spider',
94-
'connection_timeout' => 0
93+
'userAgent' => 'My spider',
94+
'connectionTimeout' => 0
9595
));
9696
```
9797

9898
Or you can set your custom resolver class and the configuration at the same time:
9999

100100
```php
101101
Embed\Request::setDefaultResolver('MyCustomResolverClass', array(
102-
'user_agent' => 'My spider',
103-
'connection_timeout' => 0
102+
'userAgent' => 'My spider',
103+
'connectionTimeout' => 0
104104
));
105105
```
106106

0 commit comments

Comments
 (0)