@@ -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 {
@@ -335,8 +334,8 @@ public function batchResult($jobId, $batchId, $isBatchedResult = false, $resultI
335
334
$ result ['records ' ] = [];
336
335
}
337
336
338
- if (isset ($ result ['result ' ])){
339
- if (!is_array ($ result ['result ' ])){
337
+ if (isset ($ result ['result ' ])) {
338
+ if (!is_array ($ result ['result ' ])) {
340
339
$ result ['result ' ] = [$ result ['result ' ]];
341
340
}
342
341
$ result = array_merge ($ result , $ result ['result ' ]);
@@ -523,16 +522,17 @@ protected function batchResponseFormatFromContentType($contentType)
523
522
524
523
protected function parsePkChunkingHeader ($ pk_chunk_header )
525
524
{
526
- if (is_array ($ pk_chunk_header )){
525
+ if (is_array ($ pk_chunk_header )) {
527
526
$ header_parts = [];
528
- foreach ($ pk_chunk_header as $ key=> $ value ) {
527
+ foreach ($ pk_chunk_header as $ key => $ value ) {
529
528
$ header_parts [] = $ key .'= ' .$ value ;
530
529
}
531
530
532
- return implode ('; ' ,$ header_parts );
533
- }elseif (in_array ($ pk_chunk_header , [true ,'true ' ,'TRUE ' ])){
531
+ return implode ('; ' , $ header_parts );
532
+ } elseif (in_array ($ pk_chunk_header , [true , 'true ' , 'TRUE ' ])) {
534
533
return 'TRUE ' ;
535
534
}
535
+
536
536
return 'FALSE ' ;
537
537
}
538
538
}
0 commit comments