From 33239e122af42e02ad8b57e8ec6e1fa92e13f9bd Mon Sep 17 00:00:00 2001 From: Aaron Bauman Date: Mon, 10 Dec 2018 10:33:54 -0500 Subject: [PATCH] Merge Update SforceHeaderOptions.php from https://github.com/developerforce/Force.com-Toolkit-for-PHP/pull/57 --- soapclient/SforceHeaderOptions.php | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/soapclient/SforceHeaderOptions.php b/soapclient/SforceHeaderOptions.php index 77e3f85..00e0e55 100644 --- a/soapclient/SforceHeaderOptions.php +++ b/soapclient/SforceHeaderOptions.php @@ -107,17 +107,31 @@ public function __construct($orgId = NULL, $portalId = NULL) { * @package SalesforceSoapClient */ class QueryOptions { - // 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. + /** @var int */ public $batchSize; /** - * Constructor - * * @param int $limit Batch size */ - public function __construct($limit) { + public function __construct($limit = 500) { + $this->validateLimit($limit); $this->batchSize = $limit; } + + /** + * @param int $limit + * + * @throws Exception + */ + private function validateLimit($limit) + { + if ($limit < 200) { + throw new \Exception('The batch size limit can\'t be lower than 200'); + } + if ($limit > 2000) { + throw new \Exception('The batch size limit can\'t be higher than 2000'); + } + } } class EmailHeader {