@@ -73,7 +73,7 @@ public function runBatch($operation, $objectType, $data, $options = [])
73
73
$ time = time ();
74
74
$ timeout = $ time + $ options ['batchTimeout ' ];
75
75
76
- if ($ options ['Sforce-Enable-PKChunking ' ]){
76
+ if ($ options ['Sforce-Enable-PKChunking ' ]) {
77
77
$ batches = $ this ->allBatchDetails ($ job ->id , $ options ['contentType ' ]);
78
78
}
79
79
@@ -89,8 +89,7 @@ public function runBatch($operation, $objectType, $data, $options = [])
89
89
90
90
$ batch = $ this ->batchDetails ($ job ->id , $ batch ->id , $ options ['contentType ' ]);
91
91
if (in_array ($ batch ->state , ['Completed ' , 'Failed ' , 'Not Processed ' , 'NotProcessed ' ])) {
92
-
93
- if (in_array ($ batch ->state , ['Completed ' ])) {
92
+ if (in_array ($ batch ->state , ['Completed ' ])) {
94
93
$ batchResult = $ this ->batchResult ($ job ->id , $ batch ->id , $ options ['isBatchedResult ' ], null , $ options ['contentType ' ]);
95
94
$ batch ->records = $ batchResult ->records ;
96
95
}
@@ -126,7 +125,7 @@ public function runBatch($operation, $objectType, $data, $options = [])
126
125
*
127
126
* @return BulkJobResponse
128
127
*/
129
- public function createJob ($ operation , $ objectType , $ externalIdFieldName = null , $ contentType = 'JSON ' , $ concurrencyMode = 'Parallel ' , $ options= [])
128
+ public function createJob ($ operation , $ objectType , $ externalIdFieldName = null , $ contentType = 'JSON ' , $ concurrencyMode = 'Parallel ' , $ options = [])
130
129
{
131
130
$ url = '/services/async/ ' .SalesforceConfig::get ('salesforce.api.version ' ).'/job ' ;
132
131
@@ -138,7 +137,7 @@ public function createJob($operation, $objectType, $externalIdFieldName = null,
138
137
139
138
$ headers = [];
140
139
141
- if (isset ($ options ['Sforce-Enable-PKChunking ' ]) && $ options ['Sforce-Enable-PKChunking ' ]){
140
+ if (isset ($ options ['Sforce-Enable-PKChunking ' ]) && $ options ['Sforce-Enable-PKChunking ' ]) {
142
141
$ headers ['Sforce-Enable-PKChunking ' ] = $ this ->parsePkChunkingHeader ($ options ['Sforce-Enable-PKChunking ' ]);
143
142
}
144
143
@@ -161,7 +160,7 @@ public function createJob($operation, $objectType, $externalIdFieldName = null,
161
160
return new BulkJobResponse ();
162
161
}
163
162
164
- public function jobDetails ($ jobId , $ format= 'json ' )
163
+ public function jobDetails ($ jobId , $ format = 'json ' )
165
164
{
166
165
$ url = '/services/async/ ' .SalesforceConfig::get ('salesforce.api.version ' ).'/job/ ' .$ jobId ;
167
166
@@ -209,7 +208,7 @@ public function closeJob($jobId)
209
208
*
210
209
* @return BulkBatchResponse
211
210
*/
212
- public function addBatch ($ jobId , $ data , $ format= 'json ' )
211
+ public function addBatch ($ jobId , $ data , $ format = 'json ' )
213
212
{
214
213
if (!$ jobId ) {
215
214
//throw exception
@@ -287,7 +286,7 @@ public function allBatchDetails($jobId, $format = 'json')
287
286
]);
288
287
289
288
if ($ result && is_array ($ result ) && isset ($ result ['batchInfo ' ]) && !isset ($ result ['batchInfo ' ]['id ' ])) {
290
- foreach ($ result ['batchInfo ' ] as $ batch ) {
289
+ foreach ($ result ['batchInfo ' ] as $ batch ) {
291
290
$ batches [] = new BulkBatchResponse ($ batch );
292
291
}
293
292
} else {
@@ -318,7 +317,7 @@ public function batchResult($jobId, $batchId, $isBatchedResult = false, $resultI
318
317
if ($ resultId ) {
319
318
$ url = $ url .'/ ' .$ resultId ;
320
319
$ resultPostArray ['format ' ] = $ format ;
321
- }else {
320
+ } else {
322
321
$ resultPostArray ['format ' ] = $ this ->batchResponseFormatFromContentType ($ format );
323
322
}
324
323
@@ -331,8 +330,8 @@ public function batchResult($jobId, $batchId, $isBatchedResult = false, $resultI
331
330
$ result ['records ' ] = [];
332
331
}
333
332
334
- if (isset ($ result ['result ' ])){
335
- if (!is_array ($ result ['result ' ])){
333
+ if (isset ($ result ['result ' ])) {
334
+ if (!is_array ($ result ['result ' ])) {
336
335
$ result ['result ' ] = [$ result ['result ' ]];
337
336
}
338
337
$ result = array_merge ($ result , $ result ['result ' ]);
@@ -519,16 +518,17 @@ protected function batchResponseFormatFromContentType($contentType)
519
518
520
519
protected function parsePkChunkingHeader ($ pk_chunk_header )
521
520
{
522
- if (is_array ($ pk_chunk_header )){
521
+ if (is_array ($ pk_chunk_header )) {
523
522
$ header_parts = [];
524
- foreach ($ pk_chunk_header as $ key=> $ value ) {
523
+ foreach ($ pk_chunk_header as $ key => $ value ) {
525
524
$ header_parts [] = $ key .'= ' .$ value ;
526
525
}
527
526
528
- return implode ('; ' ,$ header_parts );
529
- }elseif (in_array ($ pk_chunk_header , [true ,'true ' ,'TRUE ' ])){
527
+ return implode ('; ' , $ header_parts );
528
+ } elseif (in_array ($ pk_chunk_header , [true , 'true ' , 'TRUE ' ])) {
530
529
return 'TRUE ' ;
531
530
}
531
+
532
532
return 'FALSE ' ;
533
533
}
534
534
}
0 commit comments