Skip to content

Commit 33239e1

Browse files
committed
Merge Update SforceHeaderOptions.php from developerforce#57
1 parent 221a7a8 commit 33239e1

1 file changed

Lines changed: 18 additions & 4 deletions

File tree

soapclient/SforceHeaderOptions.php

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,17 +107,31 @@ public function __construct($orgId = NULL, $portalId = NULL) {
107107
* @package SalesforceSoapClient
108108
*/
109109
class QueryOptions {
110-
// int - Batch size for the number of records returned in a query or queryMore call. The default is 500; the minimum is 200, and the maximum is 2,000.
110+
/** @var int */
111111
public $batchSize;
112112

113113
/**
114-
* Constructor
115-
*
116114
* @param int $limit Batch size
117115
*/
118-
public function __construct($limit) {
116+
public function __construct($limit = 500) {
117+
$this->validateLimit($limit);
119118
$this->batchSize = $limit;
120119
}
120+
121+
/**
122+
* @param int $limit
123+
*
124+
* @throws Exception
125+
*/
126+
private function validateLimit($limit)
127+
{
128+
if ($limit < 200) {
129+
throw new \Exception('The batch size limit can\'t be lower than 200');
130+
}
131+
if ($limit > 2000) {
132+
throw new \Exception('The batch size limit can\'t be higher than 2000');
133+
}
134+
}
121135
}
122136

123137
class EmailHeader {

0 commit comments

Comments
 (0)