Completed
Pull Request — master (#2)
by
unknown
11:00
created
src/Davispeixoto/ForceDotComToolkitForPhp/SforceBaseClient.php 3 patches
Doc Comments   +19 added lines, -3 removed lines patch added patch discarded remove patch
@@ -64,6 +64,9 @@  discard block
 block discarded – undo
64 64
     protected $localeOptions;
65 65
     protected $packageVersionHeader;
66 66
 
67
+    /**
68
+     * @param string $wsdl
69
+     */
67 70
     protected function getSoapClient($wsdl, $options)
68 71
     {
69 72
         return new SoapClient($wsdl, $options);
@@ -230,6 +233,9 @@  discard block
 block discarded – undo
230 233
         $this->sforce->__setLocation($location);
231 234
     }
232 235
 
236
+    /**
237
+     * @param string $call
238
+     */
233 239
     private function setHeaders($call = null)
234 240
     {
235 241
         $this->sforce->__setSoapHeaders(null);
@@ -553,6 +559,9 @@  discard block
 block discarded – undo
553 559
         return $this->sforce->create($arg)->result;
554 560
     }
555 561
 
562
+    /**
563
+     * @param stdClass $arg
564
+     */
556 565
     protected function _merge($arg)
557 566
     {
558 567
         $this->setHeaders("merge");
@@ -560,6 +569,9 @@  discard block
 block discarded – undo
560 569
         return $this->sforce->merge($arg)->result;
561 570
     }
562 571
 
572
+    /**
573
+     * @param stdClass $arg
574
+     */
563 575
     protected function _process($arg)
564 576
     {
565 577
         $this->setHeaders();
@@ -567,6 +579,9 @@  discard block
 block discarded – undo
567 579
         return $this->sforce->process($arg)->result;
568 580
     }
569 581
 
582
+    /**
583
+     * @param stdClass $arg
584
+     */
570 585
     protected function _update($arg)
571 586
     {
572 587
         $this->setHeaders("update");
@@ -574,6 +589,9 @@  discard block
 block discarded – undo
574 589
         return $this->sforce->update($arg)->result;
575 590
     }
576 591
 
592
+    /**
593
+     * @param stdClass $arg
594
+     */
577 595
     protected function _upsert($arg)
578 596
     {
579 597
         $this->setHeaders("upsert");
@@ -890,7 +908,6 @@  discard block
 block discarded – undo
890 908
      * the specified criteria.
891 909
      *
892 910
      * @param string $query Query String
893
-     * @param QueryOptions $queryOptions Batch size limit.  OPTIONAL
894 911
      * @return QueryResult
895 912
      */
896 913
     public function query($query)
@@ -908,7 +925,6 @@  discard block
 block discarded – undo
908 925
      * Retrieves the next batch of objects from a query.
909 926
      *
910 927
      * @param string $queryLocator Represents the server-side cursor that tracks the current processing location in the query result set.
911
-     * @param QueryOptions $queryOptions Batch size limit.  OPTIONAL
912 928
      * @return QueryResult
913 929
      */
914 930
     public function queryMore($queryLocator)
@@ -964,7 +980,7 @@  discard block
 block discarded – undo
964 980
      * Executes a text search in your organization's data.
965 981
      *
966 982
      * @param string $searchString Search string that specifies the text expression to search for.
967
-     * @return SearchResult
983
+     * @return SforceSearchResult
968 984
      */
969 985
     public function search($searchString)
970 986
     {
Please login to merge, or discard this patch.
Indentation   +987 added lines, -987 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php namespace Davispeixoto\ForceDotComToolkitForPhp;
2 2
 
3
-    /*
3
+	/*
4 4
      * Copyright (c) 2007, salesforce.com, inc.
5 5
      * All rights reserved.
6 6
      *
@@ -26,10 +26,10 @@  discard block
 block discarded – undo
26 26
      * POSSIBILITY OF SUCH DAMAGE.
27 27
      */
28 28
 
29
-    /**
30
-     * This file contains one class.
31
-     * @package SalesforceSoapClient
32
-     */
29
+	/**
30
+	 * This file contains one class.
31
+	 * @package SalesforceSoapClient
32
+	 */
33 33
 use SoapClient;
34 34
 use SoapHeader;
35 35
 use SoapVar;
@@ -42,986 +42,986 @@  discard block
 block discarded – undo
42 42
  */
43 43
 class SforceBaseClient
44 44
 {
45
-    protected $sforce;
46
-    protected $sessionId;
47
-    protected $location;
48
-    protected $version = '27.0';
49
-
50
-    protected $namespace;
51
-
52
-    // Header Options
53
-    protected $callOptions;
54
-    protected $assignmentRuleHeader;
55
-    protected $emailHeader;
56
-    protected $loginScopeHeader;
57
-    protected $mruHeader;
58
-    protected $queryHeader;
59
-    protected $userTerritoryDeleteHeader;
60
-    protected $sessionHeader;
61
-
62
-    // new headers
63
-    protected $allowFieldTruncationHeader;
64
-    protected $localeOptions;
65
-    protected $packageVersionHeader;
66
-
67
-    protected function getSoapClient($wsdl, $options)
68
-    {
69
-        return new SoapClient($wsdl, $options);
70
-    }
71
-
72
-    public function getNamespace()
73
-    {
74
-        return $this->namespace;
75
-    }
76
-
77
-
78
-    // clientId specifies which application or toolkit is accessing the
79
-    // salesforce.com API. For applications that are certified salesforce.com
80
-    // solutions, replace this with the value provided by salesforce.com.
81
-    // Otherwise, leave this value as 'phpClient/1.0'.
82
-    protected $client_id;
83
-
84
-    public function printDebugInfo()
85
-    {
86
-        echo 'PHP Toolkit Version: ' . $this->version . PHP_EOL;
87
-        echo 'Current PHP version: ' . phpversion();
88
-        echo PHP_EOL;
89
-        echo 'SOAP enabled: ';
90
-        if (extension_loaded('soap')) {
91
-            echo 'True';
92
-        } else {
93
-            echo 'False';
94
-        }
95
-        echo PHP_EOL;
96
-        echo 'OpenSSL enabled: ';
97
-        if (extension_loaded('openssl')) {
98
-            echo 'True';
99
-        } else {
100
-            echo 'False';
101
-        }
102
-    }
103
-
104
-    /**
105
-     * Connect method to www.salesforce.com
106
-     *
107
-     * @param string $wsdl Salesforce.com Partner WSDL
108
-     * @param object $proxy (optional) proxy settings with properties host, port,
109
-     *                       login and password
110
-     * @param array $soap_options (optional) Additional options to send to the
111
-     *                       SoapClient constructor. @see
112
-     *                       http://php.net/manual/en/soapclient.soapclient.php
113
-     */
114
-    public function createConnection($wsdl, $proxy = null, $soap_options = array())
115
-    {
116
-        // use correct version comparison
117
-        if (version_compare(phpversion(), '5.3', '<')) {
118
-            throw new Exception ('PHP versions older than 5.3 are no longer supported. Please upgrade!');
119
-        }
120
-
121
-        $soapClientArray = array_merge(array(
122
-            'user_agent' => 'salesforce-toolkit-php/' . $this->version,
123
-            'encoding' => 'utf-8',
124
-            'trace' => 1,
125
-            'features' => SOAP_SINGLE_ELEMENT_ARRAYS,
126
-            'compression' => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP
127
-        ), $soap_options);
128
-
129
-
130
-        if ($proxy != null) {
131
-            $proxySettings = array();
132
-            $proxySettings['proxy_host'] = $proxy->host;
133
-            $proxySettings['proxy_port'] = $proxy->port; // Use an integer, not a string
134
-            $proxySettings['proxy_login'] = $proxy->login;
135
-            $proxySettings['proxy_password'] = $proxy->password;
136
-            $soapClientArray = array_merge($soapClientArray, $proxySettings);
137
-        }
138
-
139
-        $this->sforce = $this->getSoapClient($wsdl, $soapClientArray);
140
-
141
-        return $this->sforce;
142
-    }
143
-
144
-    public function setCallOptions($header)
145
-    {
146
-        if ($header != null) {
147
-            $this->callOptions = new SoapHeader($this->namespace, 'CallOptions', array(
148
-                'client' => $header->client,
149
-                'defaultNamespace' => $header->defaultNamespace
150
-            ));
151
-        } else {
152
-            $this->callOptions = null;
153
-        }
154
-    }
155
-
156
-    /**
157
-     * Login to Salesforce.com and starts a client session.
158
-     *
159
-     * @param string $username Username
160
-     * @param string $password Password
161
-     *
162
-     * @return LoginResult
163
-     */
164
-    public function login($username, $password)
165
-    {
166
-        $this->sforce->__setSoapHeaders(null);
167
-        if ($this->callOptions != null) {
168
-            $this->sforce->__setSoapHeaders(array($this->callOptions));
169
-        }
170
-        if ($this->loginScopeHeader != null) {
171
-            $this->sforce->__setSoapHeaders(array($this->loginScopeHeader));
172
-        }
173
-        $result = $this->sforce->login(array(
174
-            'username' => $username,
175
-            'password' => $password
176
-        ));
177
-        $result = $result->result;
178
-        $this->_setLoginHeader($result);
179
-
180
-        return $result;
181
-    }
182
-
183
-    /**
184
-     * log outs from the salseforce system`
185
-     *
186
-     * @return LogoutResult
187
-     */
188
-    public function logout()
189
-    {
190
-        $this->setHeaders("logout");
191
-        $arg = new stdClass();
192
-
193
-        return $this->sforce->logout();
194
-    }
195
-
196
-    /**
197
-     *invalidate Sessions from the salseforce system`
198
-     *
199
-     * @return invalidateSessionsResult
200
-     */
201
-    public function invalidateSessions()
202
-    {
203
-        $this->setHeaders("invalidateSessions");
204
-        $arg = new stdClass();
205
-        $this->logout();
206
-
207
-        return $this->sforce->invalidateSessions();
208
-    }
209
-
210
-    /**
211
-     * Specifies the session ID returned from the login server after a successful
212
-     * login.
213
-     */
214
-    protected function _setLoginHeader($loginResult)
215
-    {
216
-        $this->sessionId = $loginResult->sessionId;
217
-        $this->setSessionHeader($this->sessionId);
218
-        $serverURL = $loginResult->serverUrl;
219
-        $this->setEndPoint($serverURL);
220
-    }
221
-
222
-    /**
223
-     * Set the endpoint.
224
-     *
225
-     * @param string $location Location
226
-     */
227
-    public function setEndpoint($location)
228
-    {
229
-        $this->location = $location;
230
-        $this->sforce->__setLocation($location);
231
-    }
232
-
233
-    private function setHeaders($call = null)
234
-    {
235
-        $this->sforce->__setSoapHeaders(null);
236
-
237
-        $header_array = array(
238
-            $this->sessionHeader
239
-        );
240
-
241
-        $header = $this->callOptions;
242
-        if ($header != null) {
243
-            array_push($header_array, $header);
244
-        }
245
-
246
-        if ($call == "create" ||
247
-            $call == "merge" ||
248
-            $call == "update" ||
249
-            $call == "upsert"
250
-        ) {
251
-            $header = $this->assignmentRuleHeader;
252
-            if ($header != null) {
253
-                array_push($header_array, $header);
254
-            }
255
-        }
256
-
257
-        if ($call == "login") {
258
-            $header = $this->loginScopeHeader;
259
-            if ($header != null) {
260
-                array_push($header_array, $header);
261
-            }
262
-        }
263
-
264
-        if ($call == "create" ||
265
-            $call == "resetPassword" ||
266
-            $call == "update" ||
267
-            $call == "upsert"
268
-        ) {
269
-            $header = $this->emailHeader;
270
-            if ($header != null) {
271
-                array_push($header_array, $header);
272
-            }
273
-        }
274
-
275
-        if ($call == "create" ||
276
-            $call == "merge" ||
277
-            $call == "query" ||
278
-            $call == "retrieve" ||
279
-            $call == "update" ||
280
-            $call == "upsert"
281
-        ) {
282
-            $header = $this->mruHeader;
283
-            if ($header != null) {
284
-                array_push($header_array, $header);
285
-            }
286
-        }
287
-
288
-        if ($call == "delete") {
289
-            $header = $this->userTerritoryDeleteHeader;
290
-            if ($header != null) {
291
-                array_push($header_array, $header);
292
-            }
293
-        }
294
-
295
-        if ($call == "query" ||
296
-            $call == "queryMore" ||
297
-            $call == "retrieve"
298
-        ) {
299
-            $header = $this->queryHeader;
300
-            if ($header != null) {
301
-                array_push($header_array, $header);
302
-            }
303
-        }
304
-
305
-        // try to add allowFieldTruncationHeader
306
-        $allowFieldTruncationHeaderCalls = array(
307
-            'convertLead',
308
-            'create',
309
-            'merge',
310
-            'process',
311
-            'undelete',
312
-            'update',
313
-            'upsert',
314
-        );
315
-        if (in_array($call, $allowFieldTruncationHeaderCalls)) {
316
-            $header = $this->allowFieldTruncationHeader;
317
-            if ($header != null) {
318
-                array_push($header_array, $header);
319
-            }
320
-        }
321
-
322
-        // try to add localeOptions
323
-        if ($call == 'describeSObject' || $call == 'describeSObjects') {
324
-            $header = $this->localeOptions;
325
-            if ($header != null) {
326
-                array_push($header_array, $header);
327
-            }
328
-        }
329
-
330
-        // try to add PackageVersionHeader
331
-        $packageVersionHeaderCalls = array(
332
-            'convertLead',
333
-            'create',
334
-            'delete',
335
-            'describeGlobal',
336
-            'describeLayout',
337
-            'describeSObject',
338
-            'describeSObjects',
339
-            'describeSoftphoneLayout',
340
-            'describeTabs',
341
-            'merge',
342
-            'process',
343
-            'query',
344
-            'retrieve',
345
-            'search',
346
-            'undelete',
347
-            'update',
348
-            'upsert',
349
-        );
350
-
351
-        if (in_array($call, $packageVersionHeaderCalls)) {
352
-            $header = $this->packageVersionHeader;
353
-            if ($header != null) {
354
-                array_push($header_array, $header);
355
-            }
356
-        }
357
-
358
-        $this->sforce->__setSoapHeaders($header_array);
359
-    }
360
-
361
-    public function setAssignmentRuleHeader($header)
362
-    {
363
-        if ($header != null) {
364
-            $this->assignmentRuleHeader = new SoapHeader($this->namespace, 'AssignmentRuleHeader', array(
365
-                'assignmentRuleId' => $header->assignmentRuleId,
366
-                'useDefaultRule' => $header->useDefaultRuleFlag
367
-            ));
368
-        } else {
369
-            $this->assignmentRuleHeader = null;
370
-        }
371
-    }
372
-
373
-    public function setEmailHeader($header)
374
-    {
375
-        if ($header != null) {
376
-            $this->emailHeader = new SoapHeader($this->namespace, 'EmailHeader', array(
377
-                'triggerAutoResponseEmail' => $header->triggerAutoResponseEmail,
378
-                'triggerOtherEmail' => $header->triggerOtherEmail,
379
-                'triggerUserEmail' => $header->triggerUserEmail
380
-            ));
381
-        } else {
382
-            $this->emailHeader = null;
383
-        }
384
-    }
385
-
386
-    public function setLoginScopeHeader($header)
387
-    {
388
-        if ($header != null) {
389
-            $this->loginScopeHeader = new SoapHeader($this->namespace, 'LoginScopeHeader', array(
390
-                'organizationId' => $header->organizationId,
391
-                'portalId' => $header->portalId
392
-            ));
393
-        } else {
394
-            $this->loginScopeHeader = null;
395
-        }
396
-    }
397
-
398
-    public function setMruHeader($header)
399
-    {
400
-        if ($header != null) {
401
-            $this->mruHeader = new SoapHeader($this->namespace, 'MruHeader', array(
402
-                'updateMru' => $header->updateMruFlag
403
-            ));
404
-        } else {
405
-            $this->mruHeader = null;
406
-        }
407
-    }
408
-
409
-    public function setSessionHeader($id)
410
-    {
411
-        if ($id != null) {
412
-            $this->sessionHeader = new SoapHeader($this->namespace, 'SessionHeader', array(
413
-                'sessionId' => $id
414
-            ));
415
-            $this->sessionId = $id;
416
-        } else {
417
-            $this->sessionHeader = null;
418
-            $this->sessionId = null;
419
-        }
420
-    }
421
-
422
-    public function setUserTerritoryDeleteHeader($header)
423
-    {
424
-        if ($header != null) {
425
-            $this->userTerritoryDeleteHeader = new SoapHeader($this->namespace, 'UserTerritoryDeleteHeader  ', array(
426
-                'transferToUserId' => $header->transferToUserId
427
-            ));
428
-        } else {
429
-            $this->userTerritoryDeleteHeader = null;
430
-        }
431
-    }
432
-
433
-    public function setQueryOptions($header)
434
-    {
435
-        if ($header != null) {
436
-            $this->queryHeader = new SoapHeader($this->namespace, 'QueryOptions', array(
437
-                'batchSize' => $header->batchSize
438
-            ));
439
-        } else {
440
-            $this->queryHeader = null;
441
-        }
442
-    }
443
-
444
-    public function setAllowFieldTruncationHeader($header)
445
-    {
446
-        if ($header != null) {
447
-            $this->allowFieldTruncationHeader = new SoapHeader($this->namespace, 'AllowFieldTruncationHeader', array(
448
-                    'allowFieldTruncation' => $header->allowFieldTruncation
449
-                )
450
-            );
451
-        } else {
452
-            $this->allowFieldTruncationHeader = null;
453
-        }
454
-    }
455
-
456
-    public function setLocaleOptions($header)
457
-    {
458
-        if ($header != null) {
459
-            $this->localeOptions = new SoapHeader($this->namespace, 'LocaleOptions',
460
-                array(
461
-                    'language' => $header->language
462
-                )
463
-            );
464
-        } else {
465
-            $this->localeOptions = null;
466
-        }
467
-    }
468
-
469
-    /**
470
-     * @param $header
471
-     */
472
-    public function setPackageVersionHeader($header)
473
-    {
474
-        if ($header != null) {
475
-            $headerData = array('packageVersions' => array());
476
-
477
-            foreach ($header->packageVersions as $key => $hdrElem) {
478
-                $headerData['packageVersions'][] = array(
479
-                    'majorNumber' => $hdrElem->majorNumber,
480
-                    'minorNumber' => $hdrElem->minorNumber,
481
-                    'namespace' => $hdrElem->namespace,
482
-                );
483
-            }
484
-
485
-            $this->packageVersionHeader = new SoapHeader($this->namespace,
486
-                'PackageVersionHeader',
487
-                $headerData
488
-            );
489
-        } else {
490
-            $this->packageVersionHeader = null;
491
-        }
492
-    }
493
-
494
-    public function getSessionId()
495
-    {
496
-        return $this->sessionId;
497
-    }
498
-
499
-    public function getLocation()
500
-    {
501
-        return $this->location;
502
-    }
503
-
504
-    public function getConnection()
505
-    {
506
-        return $this->sforce;
507
-    }
508
-
509
-    public function getFunctions()
510
-    {
511
-        return $this->sforce->__getFunctions();
512
-    }
513
-
514
-    public function getTypes()
515
-    {
516
-        return $this->sforce->__getTypes();
517
-    }
518
-
519
-    public function getLastRequest()
520
-    {
521
-        return $this->sforce->__getLastRequest();
522
-    }
523
-
524
-    public function getLastRequestHeaders()
525
-    {
526
-        return $this->sforce->__getLastRequestHeaders();
527
-    }
528
-
529
-    public function getLastResponse()
530
-    {
531
-        return $this->sforce->__getLastResponse();
532
-    }
533
-
534
-    public function getLastResponseHeaders()
535
-    {
536
-        return $this->sforce->__getLastResponseHeaders();
537
-    }
538
-
539
-    protected function _convertToAny($fields)
540
-    {
541
-        $anyString = '';
542
-        foreach ($fields as $key => $value) {
543
-            $anyString = $anyString . '<' . $key . '>' . $value . '</' . $key . '>';
544
-        }
545
-
546
-        return $anyString;
547
-    }
548
-
549
-    protected function _create($arg)
550
-    {
551
-        $this->setHeaders("create");
552
-
553
-        return $this->sforce->create($arg)->result;
554
-    }
555
-
556
-    protected function _merge($arg)
557
-    {
558
-        $this->setHeaders("merge");
559
-
560
-        return $this->sforce->merge($arg)->result;
561
-    }
562
-
563
-    protected function _process($arg)
564
-    {
565
-        $this->setHeaders();
566
-
567
-        return $this->sforce->process($arg)->result;
568
-    }
569
-
570
-    protected function _update($arg)
571
-    {
572
-        $this->setHeaders("update");
573
-
574
-        return $this->sforce->update($arg)->result;
575
-    }
576
-
577
-    protected function _upsert($arg)
578
-    {
579
-        $this->setHeaders("upsert");
580
-
581
-        return $this->sforce->upsert($arg)->result;
582
-    }
583
-
584
-    public function sendSingleEmail($request)
585
-    {
586
-        if (is_array($request)) {
587
-            $messages = array();
588
-            foreach ($request as $r) {
589
-                $email = new SoapVar($r, SOAP_ENC_OBJECT, 'SingleEmailMessage', $this->namespace);
590
-                array_push($messages, $email);
591
-            }
592
-            $arg = new stdClass();
593
-            $arg->messages = $messages;
594
-
595
-            return $this->_sendEmail($arg);
596
-        } else {
597
-            $backtrace = debug_backtrace();
598
-            error_log('Please pass in array to this function:  ' . $backtrace[0]['function']);
599
-            return false;
600
-        }
601
-    }
602
-
603
-    public function sendMassEmail($request)
604
-    {
605
-        if (is_array($request)) {
606
-            $messages = array();
607
-            foreach ($request as $r) {
608
-                $email = new SoapVar($r, SOAP_ENC_OBJECT, 'MassEmailMessage', $this->namespace);
609
-                array_push($messages, $email);
610
-            }
611
-            $arg = new stdClass();
612
-            $arg->messages = $messages;
613
-
614
-            return $this->_sendEmail($arg);
615
-        } else {
616
-            $backtrace = debug_backtrace();
617
-            error_log('Please pass in array to this function:  ' . $backtrace[0]['function']);
618
-            return false;
619
-        }
620
-    }
621
-
622
-    protected function _sendEmail($arg)
623
-    {
624
-        $this->setHeaders();
625
-
626
-        return $this->sforce->sendEmail($arg)->result;
627
-    }
628
-
629
-    /**
630
-     * Converts a Lead into an Account, Contact, or (optionally) an Opportunity.
631
-     *
632
-     * @param array $leadConverts Array of LeadConvert
633
-     *
634
-     * @return LeadConvertResult
635
-     */
636
-    public function convertLead($leadConverts)
637
-    {
638
-        $this->setHeaders("convertLead");
639
-        $arg = new stdClass();
640
-        $arg->leadConverts = $leadConverts;
641
-
642
-        return $this->sforce->convertLead($arg);
643
-    }
644
-
645
-    /**
646
-     * Deletes one or more new individual objects to your organization's data.
647
-     *
648
-     * @param array $ids Array of fields
649
-     * @return DeleteResult
650
-     */
651
-    public function delete($ids)
652
-    {
653
-        $this->setHeaders("delete");
654
-        $arg = new stdClass();
655
-        $arg->ids = $ids;
656
-
657
-        return $this->sforce->delete($arg)->result;
658
-    }
659
-
660
-    /**
661
-     * Deletes one or more new individual objects to your organization's data.
662
-     *
663
-     * @param array $ids Array of fields
664
-     * @return DeleteResult
665
-     */
666
-    public function undelete($ids)
667
-    {
668
-        $this->setHeaders("undelete");
669
-        $arg = new stdClass();
670
-        $arg->ids = $ids;
671
-
672
-        return $this->sforce->undelete($arg)->result;
673
-    }
674
-
675
-    /**
676
-     * Deletes one or more new individual objects to your organization's data.
677
-     *
678
-     * @param array $ids Array of fields
679
-     * @return DeleteResult
680
-     */
681
-    public function emptyRecycleBin($ids)
682
-    {
683
-        $this->setHeaders();
684
-        $arg = new stdClass();
685
-        $arg->ids = $ids;
686
-
687
-        return $this->sforce->emptyRecycleBin($arg)->result;
688
-    }
689
-
690
-    /**
691
-     * Process Submit Request for Approval
692
-     *
693
-     * @param array $processRequestArray
694
-     * @return ProcessResult
695
-     */
696
-    public function processSubmitRequest($processRequestArray)
697
-    {
698
-        if (is_array($processRequestArray)) {
699
-            foreach ($processRequestArray as &$process) {
700
-                $process = new SoapVar($process, SOAP_ENC_OBJECT, 'ProcessSubmitRequest', $this->namespace);
701
-            }
702
-            $arg = new stdClass();
703
-            $arg->actions = $processRequestArray;
704
-
705
-            return $this->_process($arg);
706
-        } else {
707
-            $backtrace = debug_backtrace();
708
-            error_log('Please pass in array to this function:  ' . $backtrace[0]['function']);
709
-            return false;
710
-        }
711
-    }
712
-
713
-    /**
714
-     * Process Work Item Request for Approval
715
-     *
716
-     * @param array $processRequestArray
717
-     * @return ProcessResult
718
-     */
719
-    public function processWorkitemRequest($processRequestArray)
720
-    {
721
-        if (is_array($processRequestArray)) {
722
-            foreach ($processRequestArray as &$process) {
723
-                $process = new SoapVar($process, SOAP_ENC_OBJECT, 'ProcessWorkitemRequest', $this->namespace);
724
-            }
725
-            $arg = new stdClass();
726
-            $arg->actions = $processRequestArray;
727
-
728
-            return $this->_process($arg);
729
-        } else {
730
-            $backtrace = debug_backtrace();
731
-            error_log('Please pass in array to this function:  ' . $backtrace[0]['function']);
732
-            return false;
733
-        }
734
-    }
735
-
736
-    /**
737
-     * Retrieves a list of available objects for your organization's data.
738
-     *
739
-     * @return DescribeGlobalResult
740
-     */
741
-    public function describeGlobal()
742
-    {
743
-        $this->setHeaders("describeGlobal");
744
-
745
-        return $this->sforce->describeGlobal()->result;
746
-    }
747
-
748
-    /**
749
-     * Use describeLayout to retrieve information about the layout (presentation
750
-     * of data to users) for a given object type. The describeLayout call returns
751
-     * metadata about a given page layout, including layouts for edit and
752
-     * display-only views and record type mappings. Note that field-level security
753
-     * and layout editability affects which fields appear in a layout.
754
-     *
755
-     * @param string Type   Object Type
756
-     * @return DescribeLayoutResult
757
-     */
758
-    public function describeLayout($type, array $recordTypeIds = null)
759
-    {
760
-        $this->setHeaders("describeLayout");
761
-        $arg = new stdClass();
762
-        $arg->sObjectType = new SoapVar($type, XSD_STRING, 'string', 'http://www.w3.org/2001/XMLSchema');
763
-        if (isset($recordTypeIds) && count($recordTypeIds)) {
764
-            $arg->recordTypeIds = $recordTypeIds;
765
-        }
766
-
767
-        return $this->sforce->describeLayout($arg)->result;
768
-    }
769
-
770
-    /**
771
-     * Describes metadata (field list and object properties) for the specified
772
-     * object.
773
-     *
774
-     * @param string $type Object type
775
-     * @return DescribsSObjectResult
776
-     */
777
-    public function describeSObject($type)
778
-    {
779
-        $this->setHeaders("describeSObject");
780
-        $arg = new stdClass();
781
-        $arg->sObjectType = new SoapVar($type, XSD_STRING, 'string', 'http://www.w3.org/2001/XMLSchema');
782
-
783
-        return $this->sforce->describeSObject($arg)->result;
784
-    }
785
-
786
-    /**
787
-     * An array-based version of describeSObject; describes metadata (field list
788
-     * and object properties) for the specified object or array of objects.
789
-     *
790
-     * @param array $arrayOfTypes Array of object types.
791
-     * @return DescribsSObjectResult
792
-     */
793
-    public function describeSObjects($arrayOfTypes)
794
-    {
795
-        $this->setHeaders("describeSObjects");
796
-
797
-        return $this->sforce->describeSObjects($arrayOfTypes)->result;
798
-    }
799
-
800
-    /**
801
-     * The describeTabs call returns information about the standard apps and
802
-     * custom apps, if any, available for the user who sends the call, including
803
-     * the list of tabs defined for each app.
804
-     *
805
-     * @return DescribeTabSetResult
806
-     */
807
-    public function describeTabs()
808
-    {
809
-        $this->setHeaders("describeTabs");
810
-
811
-        return $this->sforce->describeTabs()->result;
812
-    }
813
-
814
-    /**
815
-     * To enable data categories groups you must enable Answers or Knowledge Articles module in
816
-     * admin panel, after adding category group and assign it to Answers or Knowledge Articles
817
-     *
818
-     * @param string $sObjectType sObject Type
819
-     * @return DescribeDataCategoryGroupResult
820
-     */
821
-    public function describeDataCategoryGroups($sObjectType)
822
-    {
823
-        $this->setHeaders('describeDataCategoryGroups');
824
-        $arg = new stdClass();
825
-        $arg->sObjectType = new SoapVar($sObjectType, XSD_STRING, 'string', 'http://www.w3.org/2001/XMLSchema');
826
-
827
-        return $this->sforce->describeDataCategoryGroups($arg)->result;
828
-    }
829
-
830
-    /**
831
-     * Retrieves available category groups along with their data category structure for objects specified in the request.
832
-     *
833
-     * @param DataCategoryGroupSobjectTypePair $pairs
834
-     * @param bool $topCategoriesOnly Object Type
835
-     * @return DescribeLayoutResult
836
-     */
837
-    public function describeDataCategoryGroupStructures(array $pairs, $topCategoriesOnly)
838
-    {
839
-        $this->setHeaders('describeDataCategoryGroupStructures');
840
-        $arg = new stdClass();
841
-        $arg->pairs = $pairs;
842
-        $arg->topCategoriesOnly = new SoapVar($topCategoriesOnly, XSD_BOOLEAN, 'boolean',
843
-            'http://www.w3.org/2001/XMLSchema');
844
-
845
-        return $this->sforce->describeDataCategoryGroupStructures($arg)->result;
846
-    }
847
-
848
-    /**
849
-     * Retrieves the list of individual objects that have been deleted within the
850
-     * given timespan for the specified object.
851
-     *
852
-     * @param string $type Ojbect type
853
-     * @param string $startDate Start date
854
-     * @param string $endDate End Date
855
-     * @return GetDeletedResult
856
-     */
857
-    public function getDeleted($type, $startDate, $endDate)
858
-    {
859
-        $this->setHeaders("getDeleted");
860
-        $arg = new stdClass();
861
-        $arg->sObjectType = new SoapVar($type, XSD_STRING, 'string', 'http://www.w3.org/2001/XMLSchema');
862
-        $arg->startDate = $startDate;
863
-        $arg->endDate = $endDate;
864
-
865
-        return $this->sforce->getDeleted($arg)->result;
866
-    }
867
-
868
-    /**
869
-     * Retrieves the list of individual objects that have been updated (added or
870
-     * changed) within the given timespan for the specified object.
871
-     *
872
-     * @param string $type Ojbect type
873
-     * @param string $startDate Start date
874
-     * @param string $endDate End Date
875
-     * @return GetUpdatedResult
876
-     */
877
-    public function getUpdated($type, $startDate, $endDate)
878
-    {
879
-        $this->setHeaders("getUpdated");
880
-        $arg = new stdClass();
881
-        $arg->sObjectType = new SoapVar($type, XSD_STRING, 'string', 'http://www.w3.org/2001/XMLSchema');
882
-        $arg->startDate = $startDate;
883
-        $arg->endDate = $endDate;
884
-
885
-        return $this->sforce->getUpdated($arg)->result;
886
-    }
887
-
888
-    /**
889
-     * Executes a query against the specified object and returns data that matches
890
-     * the specified criteria.
891
-     *
892
-     * @param string $query Query String
893
-     * @param QueryOptions $queryOptions Batch size limit.  OPTIONAL
894
-     * @return QueryResult
895
-     */
896
-    public function query($query)
897
-    {
898
-        $this->setHeaders("query");
899
-        $raw = $this->sforce->query(array(
900
-            'queryString' => $query
901
-        ))->result;
902
-        $QueryResult = new QueryResult($raw);
903
-        $QueryResult->setSf($this); // Dependency Injection
904
-        return $QueryResult;
905
-    }
906
-
907
-    /**
908
-     * Retrieves the next batch of objects from a query.
909
-     *
910
-     * @param string $queryLocator Represents the server-side cursor that tracks the current processing location in the query result set.
911
-     * @param QueryOptions $queryOptions Batch size limit.  OPTIONAL
912
-     * @return QueryResult
913
-     */
914
-    public function queryMore($queryLocator)
915
-    {
916
-        $this->setHeaders("queryMore");
917
-        $arg = new stdClass();
918
-        $arg->queryLocator = $queryLocator;
919
-        $raw = $this->sforce->queryMore($arg)->result;
920
-        $QueryResult = new QueryResult($raw);
921
-        $QueryResult->setSf($this); // Dependency Injection
922
-        return $QueryResult;
923
-    }
924
-
925
-    /**
926
-     * Retrieves data from specified objects, whether or not they have been deleted.
927
-     *
928
-     * @param String $query Query String
929
-     * @param QueryOptions $queryOptions Batch size limit.  OPTIONAL
930
-     * @return QueryResult
931
-     */
932
-    public function queryAll($query, $queryOptions = null)
933
-    {
934
-        $this->setHeaders("queryAll");
935
-        $raw = $this->sforce->queryAll(array(
936
-            'queryString' => $query
937
-        ))->result;
938
-        $QueryResult = new QueryResult($raw);
939
-        $QueryResult->setSf($this); // Dependency Injection
940
-        return $QueryResult;
941
-    }
942
-
943
-
944
-    /**
945
-     * Retrieves one or more objects based on the specified object IDs.
946
-     *
947
-     * @param string $fieldList One or more fields separated by commas.
948
-     * @param string $sObjectType Object from which to retrieve data.
949
-     * @param array $ids Array of one or more IDs of the objects to retrieve.
950
-     * @return sObject[]
951
-     */
952
-    public function retrieve($fieldList, $sObjectType, $ids)
953
-    {
954
-        $this->setHeaders("retrieve");
955
-        $arg = new stdClass();
956
-        $arg->fieldList = $fieldList;
957
-        $arg->sObjectType = new SoapVar($sObjectType, XSD_STRING, 'string', 'http://www.w3.org/2001/XMLSchema');
958
-        $arg->ids = $ids;
959
-
960
-        return $this->sforce->retrieve($arg)->result;
961
-    }
962
-
963
-    /**
964
-     * Executes a text search in your organization's data.
965
-     *
966
-     * @param string $searchString Search string that specifies the text expression to search for.
967
-     * @return SearchResult
968
-     */
969
-    public function search($searchString)
970
-    {
971
-        $this->setHeaders("search");
972
-        $arg = new stdClass();
973
-        $arg->searchString = new SoapVar($searchString, XSD_STRING, 'string', 'http://www.w3.org/2001/XMLSchema');
974
-
975
-        return new SforceSearchResult($this->sforce->search($arg)->result);
976
-    }
977
-
978
-    /**
979
-     * Retrieves the current system timestamp (GMT) from the Web service.
980
-     *
981
-     * @return timestamp
982
-     */
983
-    public function getServerTimestamp()
984
-    {
985
-        $this->setHeaders("getServerTimestamp");
986
-
987
-        return $this->sforce->getServerTimestamp()->result;
988
-    }
989
-
990
-    public function getUserInfo()
991
-    {
992
-        $this->setHeaders("getUserInfo");
993
-
994
-        return $this->sforce->getUserInfo()->result;
995
-    }
996
-
997
-    /**
998
-     * Sets the specified user's password to the specified value.
999
-     *
1000
-     * @param string $userId ID of the User.
1001
-     * @param string $password New password
1002
-     */
1003
-    public function setPassword($userId, $password)
1004
-    {
1005
-        $this->setHeaders("setPassword");
1006
-        $arg = new stdClass();
1007
-        $arg->userId = new SoapVar($userId, XSD_STRING, 'string', 'http://www.w3.org/2001/XMLSchema');
1008
-        $arg->password = $password;
1009
-
1010
-        return $this->sforce->setPassword($arg);
1011
-    }
1012
-
1013
-    /**
1014
-     * Changes a user's password to a system-generated value.
1015
-     *
1016
-     * @param string $userId Id of the User
1017
-     * @return password
1018
-     */
1019
-    public function resetPassword($userId)
1020
-    {
1021
-        $this->setHeaders("resetPassword");
1022
-        $arg = new stdClass();
1023
-        $arg->userId = new SoapVar($userId, XSD_STRING, 'string', 'http://www.w3.org/2001/XMLSchema');
1024
-
1025
-        return $this->sforce->resetPassword($arg)->result;
1026
-    }
45
+	protected $sforce;
46
+	protected $sessionId;
47
+	protected $location;
48
+	protected $version = '27.0';
49
+
50
+	protected $namespace;
51
+
52
+	// Header Options
53
+	protected $callOptions;
54
+	protected $assignmentRuleHeader;
55
+	protected $emailHeader;
56
+	protected $loginScopeHeader;
57
+	protected $mruHeader;
58
+	protected $queryHeader;
59
+	protected $userTerritoryDeleteHeader;
60
+	protected $sessionHeader;
61
+
62
+	// new headers
63
+	protected $allowFieldTruncationHeader;
64
+	protected $localeOptions;
65
+	protected $packageVersionHeader;
66
+
67
+	protected function getSoapClient($wsdl, $options)
68
+	{
69
+		return new SoapClient($wsdl, $options);
70
+	}
71
+
72
+	public function getNamespace()
73
+	{
74
+		return $this->namespace;
75
+	}
76
+
77
+
78
+	// clientId specifies which application or toolkit is accessing the
79
+	// salesforce.com API. For applications that are certified salesforce.com
80
+	// solutions, replace this with the value provided by salesforce.com.
81
+	// Otherwise, leave this value as 'phpClient/1.0'.
82
+	protected $client_id;
83
+
84
+	public function printDebugInfo()
85
+	{
86
+		echo 'PHP Toolkit Version: ' . $this->version . PHP_EOL;
87
+		echo 'Current PHP version: ' . phpversion();
88
+		echo PHP_EOL;
89
+		echo 'SOAP enabled: ';
90
+		if (extension_loaded('soap')) {
91
+			echo 'True';
92
+		} else {
93
+			echo 'False';
94
+		}
95
+		echo PHP_EOL;
96
+		echo 'OpenSSL enabled: ';
97
+		if (extension_loaded('openssl')) {
98
+			echo 'True';
99
+		} else {
100
+			echo 'False';
101
+		}
102
+	}
103
+
104
+	/**
105
+	 * Connect method to www.salesforce.com
106
+	 *
107
+	 * @param string $wsdl Salesforce.com Partner WSDL
108
+	 * @param object $proxy (optional) proxy settings with properties host, port,
109
+	 *                       login and password
110
+	 * @param array $soap_options (optional) Additional options to send to the
111
+	 *                       SoapClient constructor. @see
112
+	 *                       http://php.net/manual/en/soapclient.soapclient.php
113
+	 */
114
+	public function createConnection($wsdl, $proxy = null, $soap_options = array())
115
+	{
116
+		// use correct version comparison
117
+		if (version_compare(phpversion(), '5.3', '<')) {
118
+			throw new Exception ('PHP versions older than 5.3 are no longer supported. Please upgrade!');
119
+		}
120
+
121
+		$soapClientArray = array_merge(array(
122
+			'user_agent' => 'salesforce-toolkit-php/' . $this->version,
123
+			'encoding' => 'utf-8',
124
+			'trace' => 1,
125
+			'features' => SOAP_SINGLE_ELEMENT_ARRAYS,
126
+			'compression' => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP
127
+		), $soap_options);
128
+
129
+
130
+		if ($proxy != null) {
131
+			$proxySettings = array();
132
+			$proxySettings['proxy_host'] = $proxy->host;
133
+			$proxySettings['proxy_port'] = $proxy->port; // Use an integer, not a string
134
+			$proxySettings['proxy_login'] = $proxy->login;
135
+			$proxySettings['proxy_password'] = $proxy->password;
136
+			$soapClientArray = array_merge($soapClientArray, $proxySettings);
137
+		}
138
+
139
+		$this->sforce = $this->getSoapClient($wsdl, $soapClientArray);
140
+
141
+		return $this->sforce;
142
+	}
143
+
144
+	public function setCallOptions($header)
145
+	{
146
+		if ($header != null) {
147
+			$this->callOptions = new SoapHeader($this->namespace, 'CallOptions', array(
148
+				'client' => $header->client,
149
+				'defaultNamespace' => $header->defaultNamespace
150
+			));
151
+		} else {
152
+			$this->callOptions = null;
153
+		}
154
+	}
155
+
156
+	/**
157
+	 * Login to Salesforce.com and starts a client session.
158
+	 *
159
+	 * @param string $username Username
160
+	 * @param string $password Password
161
+	 *
162
+	 * @return LoginResult
163
+	 */
164
+	public function login($username, $password)
165
+	{
166
+		$this->sforce->__setSoapHeaders(null);
167
+		if ($this->callOptions != null) {
168
+			$this->sforce->__setSoapHeaders(array($this->callOptions));
169
+		}
170
+		if ($this->loginScopeHeader != null) {
171
+			$this->sforce->__setSoapHeaders(array($this->loginScopeHeader));
172
+		}
173
+		$result = $this->sforce->login(array(
174
+			'username' => $username,
175
+			'password' => $password
176
+		));
177
+		$result = $result->result;
178
+		$this->_setLoginHeader($result);
179
+
180
+		return $result;
181
+	}
182
+
183
+	/**
184
+	 * log outs from the salseforce system`
185
+	 *
186
+	 * @return LogoutResult
187
+	 */
188
+	public function logout()
189
+	{
190
+		$this->setHeaders("logout");
191
+		$arg = new stdClass();
192
+
193
+		return $this->sforce->logout();
194
+	}
195
+
196
+	/**
197
+	 *invalidate Sessions from the salseforce system`
198
+	 *
199
+	 * @return invalidateSessionsResult
200
+	 */
201
+	public function invalidateSessions()
202
+	{
203
+		$this->setHeaders("invalidateSessions");
204
+		$arg = new stdClass();
205
+		$this->logout();
206
+
207
+		return $this->sforce->invalidateSessions();
208
+	}
209
+
210
+	/**
211
+	 * Specifies the session ID returned from the login server after a successful
212
+	 * login.
213
+	 */
214
+	protected function _setLoginHeader($loginResult)
215
+	{
216
+		$this->sessionId = $loginResult->sessionId;
217
+		$this->setSessionHeader($this->sessionId);
218
+		$serverURL = $loginResult->serverUrl;
219
+		$this->setEndPoint($serverURL);
220
+	}
221
+
222
+	/**
223
+	 * Set the endpoint.
224
+	 *
225
+	 * @param string $location Location
226
+	 */
227
+	public function setEndpoint($location)
228
+	{
229
+		$this->location = $location;
230
+		$this->sforce->__setLocation($location);
231
+	}
232
+
233
+	private function setHeaders($call = null)
234
+	{
235
+		$this->sforce->__setSoapHeaders(null);
236
+
237
+		$header_array = array(
238
+			$this->sessionHeader
239
+		);
240
+
241
+		$header = $this->callOptions;
242
+		if ($header != null) {
243
+			array_push($header_array, $header);
244
+		}
245
+
246
+		if ($call == "create" ||
247
+			$call == "merge" ||
248
+			$call == "update" ||
249
+			$call == "upsert"
250
+		) {
251
+			$header = $this->assignmentRuleHeader;
252
+			if ($header != null) {
253
+				array_push($header_array, $header);
254
+			}
255
+		}
256
+
257
+		if ($call == "login") {
258
+			$header = $this->loginScopeHeader;
259
+			if ($header != null) {
260
+				array_push($header_array, $header);
261
+			}
262
+		}
263
+
264
+		if ($call == "create" ||
265
+			$call == "resetPassword" ||
266
+			$call == "update" ||
267
+			$call == "upsert"
268
+		) {
269
+			$header = $this->emailHeader;
270
+			if ($header != null) {
271
+				array_push($header_array, $header);
272
+			}
273
+		}
274
+
275
+		if ($call == "create" ||
276
+			$call == "merge" ||
277
+			$call == "query" ||
278
+			$call == "retrieve" ||
279
+			$call == "update" ||
280
+			$call == "upsert"
281
+		) {
282
+			$header = $this->mruHeader;
283
+			if ($header != null) {
284
+				array_push($header_array, $header);
285
+			}
286
+		}
287
+
288
+		if ($call == "delete") {
289
+			$header = $this->userTerritoryDeleteHeader;
290
+			if ($header != null) {
291
+				array_push($header_array, $header);
292
+			}
293
+		}
294
+
295
+		if ($call == "query" ||
296
+			$call == "queryMore" ||
297
+			$call == "retrieve"
298
+		) {
299
+			$header = $this->queryHeader;
300
+			if ($header != null) {
301
+				array_push($header_array, $header);
302
+			}
303
+		}
304
+
305
+		// try to add allowFieldTruncationHeader
306
+		$allowFieldTruncationHeaderCalls = array(
307
+			'convertLead',
308
+			'create',
309
+			'merge',
310
+			'process',
311
+			'undelete',
312
+			'update',
313
+			'upsert',
314
+		);
315
+		if (in_array($call, $allowFieldTruncationHeaderCalls)) {
316
+			$header = $this->allowFieldTruncationHeader;
317
+			if ($header != null) {
318
+				array_push($header_array, $header);
319
+			}
320
+		}
321
+
322
+		// try to add localeOptions
323
+		if ($call == 'describeSObject' || $call == 'describeSObjects') {
324
+			$header = $this->localeOptions;
325
+			if ($header != null) {
326
+				array_push($header_array, $header);
327
+			}
328
+		}
329
+
330
+		// try to add PackageVersionHeader
331
+		$packageVersionHeaderCalls = array(
332
+			'convertLead',
333
+			'create',
334
+			'delete',
335
+			'describeGlobal',
336
+			'describeLayout',
337
+			'describeSObject',
338
+			'describeSObjects',
339
+			'describeSoftphoneLayout',
340
+			'describeTabs',
341
+			'merge',
342
+			'process',
343
+			'query',
344
+			'retrieve',
345
+			'search',
346
+			'undelete',
347
+			'update',
348
+			'upsert',
349
+		);
350
+
351
+		if (in_array($call, $packageVersionHeaderCalls)) {
352
+			$header = $this->packageVersionHeader;
353
+			if ($header != null) {
354
+				array_push($header_array, $header);
355
+			}
356
+		}
357
+
358
+		$this->sforce->__setSoapHeaders($header_array);
359
+	}
360
+
361
+	public function setAssignmentRuleHeader($header)
362
+	{
363
+		if ($header != null) {
364
+			$this->assignmentRuleHeader = new SoapHeader($this->namespace, 'AssignmentRuleHeader', array(
365
+				'assignmentRuleId' => $header->assignmentRuleId,
366
+				'useDefaultRule' => $header->useDefaultRuleFlag
367
+			));
368
+		} else {
369
+			$this->assignmentRuleHeader = null;
370
+		}
371
+	}
372
+
373
+	public function setEmailHeader($header)
374
+	{
375
+		if ($header != null) {
376
+			$this->emailHeader = new SoapHeader($this->namespace, 'EmailHeader', array(
377
+				'triggerAutoResponseEmail' => $header->triggerAutoResponseEmail,
378
+				'triggerOtherEmail' => $header->triggerOtherEmail,
379
+				'triggerUserEmail' => $header->triggerUserEmail
380
+			));
381
+		} else {
382
+			$this->emailHeader = null;
383
+		}
384
+	}
385
+
386
+	public function setLoginScopeHeader($header)
387
+	{
388
+		if ($header != null) {
389
+			$this->loginScopeHeader = new SoapHeader($this->namespace, 'LoginScopeHeader', array(
390
+				'organizationId' => $header->organizationId,
391
+				'portalId' => $header->portalId
392
+			));
393
+		} else {
394
+			$this->loginScopeHeader = null;
395
+		}
396
+	}
397
+
398
+	public function setMruHeader($header)
399
+	{
400
+		if ($header != null) {
401
+			$this->mruHeader = new SoapHeader($this->namespace, 'MruHeader', array(
402
+				'updateMru' => $header->updateMruFlag
403
+			));
404
+		} else {
405
+			$this->mruHeader = null;
406
+		}
407
+	}
408
+
409
+	public function setSessionHeader($id)
410
+	{
411
+		if ($id != null) {
412
+			$this->sessionHeader = new SoapHeader($this->namespace, 'SessionHeader', array(
413
+				'sessionId' => $id
414
+			));
415
+			$this->sessionId = $id;
416
+		} else {
417
+			$this->sessionHeader = null;
418
+			$this->sessionId = null;
419
+		}
420
+	}
421
+
422
+	public function setUserTerritoryDeleteHeader($header)
423
+	{
424
+		if ($header != null) {
425
+			$this->userTerritoryDeleteHeader = new SoapHeader($this->namespace, 'UserTerritoryDeleteHeader  ', array(
426
+				'transferToUserId' => $header->transferToUserId
427
+			));
428
+		} else {
429
+			$this->userTerritoryDeleteHeader = null;
430
+		}
431
+	}
432
+
433
+	public function setQueryOptions($header)
434
+	{
435
+		if ($header != null) {
436
+			$this->queryHeader = new SoapHeader($this->namespace, 'QueryOptions', array(
437
+				'batchSize' => $header->batchSize
438
+			));
439
+		} else {
440
+			$this->queryHeader = null;
441
+		}
442
+	}
443
+
444
+	public function setAllowFieldTruncationHeader($header)
445
+	{
446
+		if ($header != null) {
447
+			$this->allowFieldTruncationHeader = new SoapHeader($this->namespace, 'AllowFieldTruncationHeader', array(
448
+					'allowFieldTruncation' => $header->allowFieldTruncation
449
+				)
450
+			);
451
+		} else {
452
+			$this->allowFieldTruncationHeader = null;
453
+		}
454
+	}
455
+
456
+	public function setLocaleOptions($header)
457
+	{
458
+		if ($header != null) {
459
+			$this->localeOptions = new SoapHeader($this->namespace, 'LocaleOptions',
460
+				array(
461
+					'language' => $header->language
462
+				)
463
+			);
464
+		} else {
465
+			$this->localeOptions = null;
466
+		}
467
+	}
468
+
469
+	/**
470
+	 * @param $header
471
+	 */
472
+	public function setPackageVersionHeader($header)
473
+	{
474
+		if ($header != null) {
475
+			$headerData = array('packageVersions' => array());
476
+
477
+			foreach ($header->packageVersions as $key => $hdrElem) {
478
+				$headerData['packageVersions'][] = array(
479
+					'majorNumber' => $hdrElem->majorNumber,
480
+					'minorNumber' => $hdrElem->minorNumber,
481
+					'namespace' => $hdrElem->namespace,
482
+				);
483
+			}
484
+
485
+			$this->packageVersionHeader = new SoapHeader($this->namespace,
486
+				'PackageVersionHeader',
487
+				$headerData
488
+			);
489
+		} else {
490
+			$this->packageVersionHeader = null;
491
+		}
492
+	}
493
+
494
+	public function getSessionId()
495
+	{
496
+		return $this->sessionId;
497
+	}
498
+
499
+	public function getLocation()
500
+	{
501
+		return $this->location;
502
+	}
503
+
504
+	public function getConnection()
505
+	{
506
+		return $this->sforce;
507
+	}
508
+
509
+	public function getFunctions()
510
+	{
511
+		return $this->sforce->__getFunctions();
512
+	}
513
+
514
+	public function getTypes()
515
+	{
516
+		return $this->sforce->__getTypes();
517
+	}
518
+
519
+	public function getLastRequest()
520
+	{
521
+		return $this->sforce->__getLastRequest();
522
+	}
523
+
524
+	public function getLastRequestHeaders()
525
+	{
526
+		return $this->sforce->__getLastRequestHeaders();
527
+	}
528
+
529
+	public function getLastResponse()
530
+	{
531
+		return $this->sforce->__getLastResponse();
532
+	}
533
+
534
+	public function getLastResponseHeaders()
535
+	{
536
+		return $this->sforce->__getLastResponseHeaders();
537
+	}
538
+
539
+	protected function _convertToAny($fields)
540
+	{
541
+		$anyString = '';
542
+		foreach ($fields as $key => $value) {
543
+			$anyString = $anyString . '<' . $key . '>' . $value . '</' . $key . '>';
544
+		}
545
+
546
+		return $anyString;
547
+	}
548
+
549
+	protected function _create($arg)
550
+	{
551
+		$this->setHeaders("create");
552
+
553
+		return $this->sforce->create($arg)->result;
554
+	}
555
+
556
+	protected function _merge($arg)
557
+	{
558
+		$this->setHeaders("merge");
559
+
560
+		return $this->sforce->merge($arg)->result;
561
+	}
562
+
563
+	protected function _process($arg)
564
+	{
565
+		$this->setHeaders();
566
+
567
+		return $this->sforce->process($arg)->result;
568
+	}
569
+
570
+	protected function _update($arg)
571
+	{
572
+		$this->setHeaders("update");
573
+
574
+		return $this->sforce->update($arg)->result;
575
+	}
576
+
577
+	protected function _upsert($arg)
578
+	{
579
+		$this->setHeaders("upsert");
580
+
581
+		return $this->sforce->upsert($arg)->result;
582
+	}
583
+
584
+	public function sendSingleEmail($request)
585
+	{
586
+		if (is_array($request)) {
587
+			$messages = array();
588
+			foreach ($request as $r) {
589
+				$email = new SoapVar($r, SOAP_ENC_OBJECT, 'SingleEmailMessage', $this->namespace);
590
+				array_push($messages, $email);
591
+			}
592
+			$arg = new stdClass();
593
+			$arg->messages = $messages;
594
+
595
+			return $this->_sendEmail($arg);
596
+		} else {
597
+			$backtrace = debug_backtrace();
598
+			error_log('Please pass in array to this function:  ' . $backtrace[0]['function']);
599
+			return false;
600
+		}
601
+	}
602
+
603
+	public function sendMassEmail($request)
604
+	{
605
+		if (is_array($request)) {
606
+			$messages = array();
607
+			foreach ($request as $r) {
608
+				$email = new SoapVar($r, SOAP_ENC_OBJECT, 'MassEmailMessage', $this->namespace);
609
+				array_push($messages, $email);
610
+			}
611
+			$arg = new stdClass();
612
+			$arg->messages = $messages;
613
+
614
+			return $this->_sendEmail($arg);
615
+		} else {
616
+			$backtrace = debug_backtrace();
617
+			error_log('Please pass in array to this function:  ' . $backtrace[0]['function']);
618
+			return false;
619
+		}
620
+	}
621
+
622
+	protected function _sendEmail($arg)
623
+	{
624
+		$this->setHeaders();
625
+
626
+		return $this->sforce->sendEmail($arg)->result;
627
+	}
628
+
629
+	/**
630
+	 * Converts a Lead into an Account, Contact, or (optionally) an Opportunity.
631
+	 *
632
+	 * @param array $leadConverts Array of LeadConvert
633
+	 *
634
+	 * @return LeadConvertResult
635
+	 */
636
+	public function convertLead($leadConverts)
637
+	{
638
+		$this->setHeaders("convertLead");
639
+		$arg = new stdClass();
640
+		$arg->leadConverts = $leadConverts;
641
+
642
+		return $this->sforce->convertLead($arg);
643
+	}
644
+
645
+	/**
646
+	 * Deletes one or more new individual objects to your organization's data.
647
+	 *
648
+	 * @param array $ids Array of fields
649
+	 * @return DeleteResult
650
+	 */
651
+	public function delete($ids)
652
+	{
653
+		$this->setHeaders("delete");
654
+		$arg = new stdClass();
655
+		$arg->ids = $ids;
656
+
657
+		return $this->sforce->delete($arg)->result;
658
+	}
659
+
660
+	/**
661
+	 * Deletes one or more new individual objects to your organization's data.
662
+	 *
663
+	 * @param array $ids Array of fields
664
+	 * @return DeleteResult
665
+	 */
666
+	public function undelete($ids)
667
+	{
668
+		$this->setHeaders("undelete");
669
+		$arg = new stdClass();
670
+		$arg->ids = $ids;
671
+
672
+		return $this->sforce->undelete($arg)->result;
673
+	}
674
+
675
+	/**
676
+	 * Deletes one or more new individual objects to your organization's data.
677
+	 *
678
+	 * @param array $ids Array of fields
679
+	 * @return DeleteResult
680
+	 */
681
+	public function emptyRecycleBin($ids)
682
+	{
683
+		$this->setHeaders();
684
+		$arg = new stdClass();
685
+		$arg->ids = $ids;
686
+
687
+		return $this->sforce->emptyRecycleBin($arg)->result;
688
+	}
689
+
690
+	/**
691
+	 * Process Submit Request for Approval
692
+	 *
693
+	 * @param array $processRequestArray
694
+	 * @return ProcessResult
695
+	 */
696
+	public function processSubmitRequest($processRequestArray)
697
+	{
698
+		if (is_array($processRequestArray)) {
699
+			foreach ($processRequestArray as &$process) {
700
+				$process = new SoapVar($process, SOAP_ENC_OBJECT, 'ProcessSubmitRequest', $this->namespace);
701
+			}
702
+			$arg = new stdClass();
703
+			$arg->actions = $processRequestArray;
704
+
705
+			return $this->_process($arg);
706
+		} else {
707
+			$backtrace = debug_backtrace();
708
+			error_log('Please pass in array to this function:  ' . $backtrace[0]['function']);
709
+			return false;
710
+		}
711
+	}
712
+
713
+	/**
714
+	 * Process Work Item Request for Approval
715
+	 *
716
+	 * @param array $processRequestArray
717
+	 * @return ProcessResult
718
+	 */
719
+	public function processWorkitemRequest($processRequestArray)
720
+	{
721
+		if (is_array($processRequestArray)) {
722
+			foreach ($processRequestArray as &$process) {
723
+				$process = new SoapVar($process, SOAP_ENC_OBJECT, 'ProcessWorkitemRequest', $this->namespace);
724
+			}
725
+			$arg = new stdClass();
726
+			$arg->actions = $processRequestArray;
727
+
728
+			return $this->_process($arg);
729
+		} else {
730
+			$backtrace = debug_backtrace();
731
+			error_log('Please pass in array to this function:  ' . $backtrace[0]['function']);
732
+			return false;
733
+		}
734
+	}
735
+
736
+	/**
737
+	 * Retrieves a list of available objects for your organization's data.
738
+	 *
739
+	 * @return DescribeGlobalResult
740
+	 */
741
+	public function describeGlobal()
742
+	{
743
+		$this->setHeaders("describeGlobal");
744
+
745
+		return $this->sforce->describeGlobal()->result;
746
+	}
747
+
748
+	/**
749
+	 * Use describeLayout to retrieve information about the layout (presentation
750
+	 * of data to users) for a given object type. The describeLayout call returns
751
+	 * metadata about a given page layout, including layouts for edit and
752
+	 * display-only views and record type mappings. Note that field-level security
753
+	 * and layout editability affects which fields appear in a layout.
754
+	 *
755
+	 * @param string Type   Object Type
756
+	 * @return DescribeLayoutResult
757
+	 */
758
+	public function describeLayout($type, array $recordTypeIds = null)
759
+	{
760
+		$this->setHeaders("describeLayout");
761
+		$arg = new stdClass();
762
+		$arg->sObjectType = new SoapVar($type, XSD_STRING, 'string', 'http://www.w3.org/2001/XMLSchema');
763
+		if (isset($recordTypeIds) && count($recordTypeIds)) {
764
+			$arg->recordTypeIds = $recordTypeIds;
765
+		}
766
+
767
+		return $this->sforce->describeLayout($arg)->result;
768
+	}
769
+
770
+	/**
771
+	 * Describes metadata (field list and object properties) for the specified
772
+	 * object.
773
+	 *
774
+	 * @param string $type Object type
775
+	 * @return DescribsSObjectResult
776
+	 */
777
+	public function describeSObject($type)
778
+	{
779
+		$this->setHeaders("describeSObject");
780
+		$arg = new stdClass();
781
+		$arg->sObjectType = new SoapVar($type, XSD_STRING, 'string', 'http://www.w3.org/2001/XMLSchema');
782
+
783
+		return $this->sforce->describeSObject($arg)->result;
784
+	}
785
+
786
+	/**
787
+	 * An array-based version of describeSObject; describes metadata (field list
788
+	 * and object properties) for the specified object or array of objects.
789
+	 *
790
+	 * @param array $arrayOfTypes Array of object types.
791
+	 * @return DescribsSObjectResult
792
+	 */
793
+	public function describeSObjects($arrayOfTypes)
794
+	{
795
+		$this->setHeaders("describeSObjects");
796
+
797
+		return $this->sforce->describeSObjects($arrayOfTypes)->result;
798
+	}
799
+
800
+	/**
801
+	 * The describeTabs call returns information about the standard apps and
802
+	 * custom apps, if any, available for the user who sends the call, including
803
+	 * the list of tabs defined for each app.
804
+	 *
805
+	 * @return DescribeTabSetResult
806
+	 */
807
+	public function describeTabs()
808
+	{
809
+		$this->setHeaders("describeTabs");
810
+
811
+		return $this->sforce->describeTabs()->result;
812
+	}
813
+
814
+	/**
815
+	 * To enable data categories groups you must enable Answers or Knowledge Articles module in
816
+	 * admin panel, after adding category group and assign it to Answers or Knowledge Articles
817
+	 *
818
+	 * @param string $sObjectType sObject Type
819
+	 * @return DescribeDataCategoryGroupResult
820
+	 */
821
+	public function describeDataCategoryGroups($sObjectType)
822
+	{
823
+		$this->setHeaders('describeDataCategoryGroups');
824
+		$arg = new stdClass();
825
+		$arg->sObjectType = new SoapVar($sObjectType, XSD_STRING, 'string', 'http://www.w3.org/2001/XMLSchema');
826
+
827
+		return $this->sforce->describeDataCategoryGroups($arg)->result;
828
+	}
829
+
830
+	/**
831
+	 * Retrieves available category groups along with their data category structure for objects specified in the request.
832
+	 *
833
+	 * @param DataCategoryGroupSobjectTypePair $pairs
834
+	 * @param bool $topCategoriesOnly Object Type
835
+	 * @return DescribeLayoutResult
836
+	 */
837
+	public function describeDataCategoryGroupStructures(array $pairs, $topCategoriesOnly)
838
+	{
839
+		$this->setHeaders('describeDataCategoryGroupStructures');
840
+		$arg = new stdClass();
841
+		$arg->pairs = $pairs;
842
+		$arg->topCategoriesOnly = new SoapVar($topCategoriesOnly, XSD_BOOLEAN, 'boolean',
843
+			'http://www.w3.org/2001/XMLSchema');
844
+
845
+		return $this->sforce->describeDataCategoryGroupStructures($arg)->result;
846
+	}
847
+
848
+	/**
849
+	 * Retrieves the list of individual objects that have been deleted within the
850
+	 * given timespan for the specified object.
851
+	 *
852
+	 * @param string $type Ojbect type
853
+	 * @param string $startDate Start date
854
+	 * @param string $endDate End Date
855
+	 * @return GetDeletedResult
856
+	 */
857
+	public function getDeleted($type, $startDate, $endDate)
858
+	{
859
+		$this->setHeaders("getDeleted");
860
+		$arg = new stdClass();
861
+		$arg->sObjectType = new SoapVar($type, XSD_STRING, 'string', 'http://www.w3.org/2001/XMLSchema');
862
+		$arg->startDate = $startDate;
863
+		$arg->endDate = $endDate;
864
+
865
+		return $this->sforce->getDeleted($arg)->result;
866
+	}
867
+
868
+	/**
869
+	 * Retrieves the list of individual objects that have been updated (added or
870
+	 * changed) within the given timespan for the specified object.
871
+	 *
872
+	 * @param string $type Ojbect type
873
+	 * @param string $startDate Start date
874
+	 * @param string $endDate End Date
875
+	 * @return GetUpdatedResult
876
+	 */
877
+	public function getUpdated($type, $startDate, $endDate)
878
+	{
879
+		$this->setHeaders("getUpdated");
880
+		$arg = new stdClass();
881
+		$arg->sObjectType = new SoapVar($type, XSD_STRING, 'string', 'http://www.w3.org/2001/XMLSchema');
882
+		$arg->startDate = $startDate;
883
+		$arg->endDate = $endDate;
884
+
885
+		return $this->sforce->getUpdated($arg)->result;
886
+	}
887
+
888
+	/**
889
+	 * Executes a query against the specified object and returns data that matches
890
+	 * the specified criteria.
891
+	 *
892
+	 * @param string $query Query String
893
+	 * @param QueryOptions $queryOptions Batch size limit.  OPTIONAL
894
+	 * @return QueryResult
895
+	 */
896
+	public function query($query)
897
+	{
898
+		$this->setHeaders("query");
899
+		$raw = $this->sforce->query(array(
900
+			'queryString' => $query
901
+		))->result;
902
+		$QueryResult = new QueryResult($raw);
903
+		$QueryResult->setSf($this); // Dependency Injection
904
+		return $QueryResult;
905
+	}
906
+
907
+	/**
908
+	 * Retrieves the next batch of objects from a query.
909
+	 *
910
+	 * @param string $queryLocator Represents the server-side cursor that tracks the current processing location in the query result set.
911
+	 * @param QueryOptions $queryOptions Batch size limit.  OPTIONAL
912
+	 * @return QueryResult
913
+	 */
914
+	public function queryMore($queryLocator)
915
+	{
916
+		$this->setHeaders("queryMore");
917
+		$arg = new stdClass();
918
+		$arg->queryLocator = $queryLocator;
919
+		$raw = $this->sforce->queryMore($arg)->result;
920
+		$QueryResult = new QueryResult($raw);
921
+		$QueryResult->setSf($this); // Dependency Injection
922
+		return $QueryResult;
923
+	}
924
+
925
+	/**
926
+	 * Retrieves data from specified objects, whether or not they have been deleted.
927
+	 *
928
+	 * @param String $query Query String
929
+	 * @param QueryOptions $queryOptions Batch size limit.  OPTIONAL
930
+	 * @return QueryResult
931
+	 */
932
+	public function queryAll($query, $queryOptions = null)
933
+	{
934
+		$this->setHeaders("queryAll");
935
+		$raw = $this->sforce->queryAll(array(
936
+			'queryString' => $query
937
+		))->result;
938
+		$QueryResult = new QueryResult($raw);
939
+		$QueryResult->setSf($this); // Dependency Injection
940
+		return $QueryResult;
941
+	}
942
+
943
+
944
+	/**
945
+	 * Retrieves one or more objects based on the specified object IDs.
946
+	 *
947
+	 * @param string $fieldList One or more fields separated by commas.
948
+	 * @param string $sObjectType Object from which to retrieve data.
949
+	 * @param array $ids Array of one or more IDs of the objects to retrieve.
950
+	 * @return sObject[]
951
+	 */
952
+	public function retrieve($fieldList, $sObjectType, $ids)
953
+	{
954
+		$this->setHeaders("retrieve");
955
+		$arg = new stdClass();
956
+		$arg->fieldList = $fieldList;
957
+		$arg->sObjectType = new SoapVar($sObjectType, XSD_STRING, 'string', 'http://www.w3.org/2001/XMLSchema');
958
+		$arg->ids = $ids;
959
+
960
+		return $this->sforce->retrieve($arg)->result;
961
+	}
962
+
963
+	/**
964
+	 * Executes a text search in your organization's data.
965
+	 *
966
+	 * @param string $searchString Search string that specifies the text expression to search for.
967
+	 * @return SearchResult
968
+	 */
969
+	public function search($searchString)
970
+	{
971
+		$this->setHeaders("search");
972
+		$arg = new stdClass();
973
+		$arg->searchString = new SoapVar($searchString, XSD_STRING, 'string', 'http://www.w3.org/2001/XMLSchema');
974
+
975
+		return new SforceSearchResult($this->sforce->search($arg)->result);
976
+	}
977
+
978
+	/**
979
+	 * Retrieves the current system timestamp (GMT) from the Web service.
980
+	 *
981
+	 * @return timestamp
982
+	 */
983
+	public function getServerTimestamp()
984
+	{
985
+		$this->setHeaders("getServerTimestamp");
986
+
987
+		return $this->sforce->getServerTimestamp()->result;
988
+	}
989
+
990
+	public function getUserInfo()
991
+	{
992
+		$this->setHeaders("getUserInfo");
993
+
994
+		return $this->sforce->getUserInfo()->result;
995
+	}
996
+
997
+	/**
998
+	 * Sets the specified user's password to the specified value.
999
+	 *
1000
+	 * @param string $userId ID of the User.
1001
+	 * @param string $password New password
1002
+	 */
1003
+	public function setPassword($userId, $password)
1004
+	{
1005
+		$this->setHeaders("setPassword");
1006
+		$arg = new stdClass();
1007
+		$arg->userId = new SoapVar($userId, XSD_STRING, 'string', 'http://www.w3.org/2001/XMLSchema');
1008
+		$arg->password = $password;
1009
+
1010
+		return $this->sforce->setPassword($arg);
1011
+	}
1012
+
1013
+	/**
1014
+	 * Changes a user's password to a system-generated value.
1015
+	 *
1016
+	 * @param string $userId Id of the User
1017
+	 * @return password
1018
+	 */
1019
+	public function resetPassword($userId)
1020
+	{
1021
+		$this->setHeaders("resetPassword");
1022
+		$arg = new stdClass();
1023
+		$arg->userId = new SoapVar($userId, XSD_STRING, 'string', 'http://www.w3.org/2001/XMLSchema');
1024
+
1025
+		return $this->sforce->resetPassword($arg)->result;
1026
+	}
1027 1027
 }
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -83,8 +83,8 @@  discard block
 block discarded – undo
83 83
 
84 84
     public function printDebugInfo()
85 85
     {
86
-        echo 'PHP Toolkit Version: ' . $this->version . PHP_EOL;
87
-        echo 'Current PHP version: ' . phpversion();
86
+        echo 'PHP Toolkit Version: '.$this->version.PHP_EOL;
87
+        echo 'Current PHP version: '.phpversion();
88 88
         echo PHP_EOL;
89 89
         echo 'SOAP enabled: ';
90 90
         if (extension_loaded('soap')) {
@@ -115,11 +115,11 @@  discard block
 block discarded – undo
115 115
     {
116 116
         // use correct version comparison
117 117
         if (version_compare(phpversion(), '5.3', '<')) {
118
-            throw new Exception ('PHP versions older than 5.3 are no longer supported. Please upgrade!');
118
+            throw new Exception('PHP versions older than 5.3 are no longer supported. Please upgrade!');
119 119
         }
120 120
 
121 121
         $soapClientArray = array_merge(array(
122
-            'user_agent' => 'salesforce-toolkit-php/' . $this->version,
122
+            'user_agent' => 'salesforce-toolkit-php/'.$this->version,
123 123
             'encoding' => 'utf-8',
124 124
             'trace' => 1,
125 125
             'features' => SOAP_SINGLE_ELEMENT_ARRAYS,
@@ -540,7 +540,7 @@  discard block
 block discarded – undo
540 540
     {
541 541
         $anyString = '';
542 542
         foreach ($fields as $key => $value) {
543
-            $anyString = $anyString . '<' . $key . '>' . $value . '</' . $key . '>';
543
+            $anyString = $anyString.'<'.$key.'>'.$value.'</'.$key.'>';
544 544
         }
545 545
 
546 546
         return $anyString;
@@ -595,7 +595,7 @@  discard block
 block discarded – undo
595 595
             return $this->_sendEmail($arg);
596 596
         } else {
597 597
             $backtrace = debug_backtrace();
598
-            error_log('Please pass in array to this function:  ' . $backtrace[0]['function']);
598
+            error_log('Please pass in array to this function:  '.$backtrace[0]['function']);
599 599
             return false;
600 600
         }
601 601
     }
@@ -614,7 +614,7 @@  discard block
 block discarded – undo
614 614
             return $this->_sendEmail($arg);
615 615
         } else {
616 616
             $backtrace = debug_backtrace();
617
-            error_log('Please pass in array to this function:  ' . $backtrace[0]['function']);
617
+            error_log('Please pass in array to this function:  '.$backtrace[0]['function']);
618 618
             return false;
619 619
         }
620 620
     }
@@ -705,7 +705,7 @@  discard block
 block discarded – undo
705 705
             return $this->_process($arg);
706 706
         } else {
707 707
             $backtrace = debug_backtrace();
708
-            error_log('Please pass in array to this function:  ' . $backtrace[0]['function']);
708
+            error_log('Please pass in array to this function:  '.$backtrace[0]['function']);
709 709
             return false;
710 710
         }
711 711
     }
@@ -728,7 +728,7 @@  discard block
 block discarded – undo
728 728
             return $this->_process($arg);
729 729
         } else {
730 730
             $backtrace = debug_backtrace();
731
-            error_log('Please pass in array to this function:  ' . $backtrace[0]['function']);
731
+            error_log('Please pass in array to this function:  '.$backtrace[0]['function']);
732 732
             return false;
733 733
         }
734 734
     }
Please login to merge, or discard this patch.
src/Davispeixoto/ForceDotComToolkitForPhp/SforceEnterpriseClient.php 3 patches
Doc Comments   -2 removed lines patch added patch discarded remove patch
@@ -51,8 +51,6 @@
 block discarded – undo
51 51
     /**
52 52
      * Adds one or more new individual objects to your organization's data.
53 53
      * @param array $sObjects Array of one or more sObjects (up to 200) to create.
54
-     * @param AssignmentRuleHeader $assignment_header is optional.  Defaults to NULL
55
-     * @param MruHeader $mru_header is optional.  Defaults to NULL
56 54
      * @return SaveResult
57 55
      */
58 56
     public function create($sObjects, $type)
Please login to merge, or discard this patch.
Indentation   +129 added lines, -129 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php namespace Davispeixoto\ForceDotComToolkitForPhp;
2 2
 
3
-    /*
3
+	/*
4 4
      * Copyright (c) 2007, salesforce.com, inc.
5 5
      * All rights reserved.
6 6
      *
@@ -26,10 +26,10 @@  discard block
 block discarded – undo
26 26
      * POSSIBILITY OF SUCH DAMAGE.
27 27
      */
28 28
 
29
-    /**
30
-     * This file contains two classes.
31
-     * @package SalesforceSoapClient
32
-     */
29
+	/**
30
+	 * This file contains two classes.
31
+	 * @package SalesforceSoapClient
32
+	 */
33 33
 use SoapParam;
34 34
 use SoapVar;
35 35
 use stdClass;
@@ -41,130 +41,130 @@  discard block
 block discarded – undo
41 41
  */
42 42
 class SforceEnterpriseClient extends SforceBaseClient
43 43
 {
44
-    const ENTERPRISE_NAMESPACE = 'urn:enterprise.soap.sforce.com';
45
-
46
-    public function __construct()
47
-    {
48
-        $this->namespace = self::ENTERPRISE_NAMESPACE;
49
-    }
50
-
51
-    /**
52
-     * Adds one or more new individual objects to your organization's data.
53
-     * @param array $sObjects Array of one or more sObjects (up to 200) to create.
54
-     * @param AssignmentRuleHeader $assignment_header is optional.  Defaults to NULL
55
-     * @param MruHeader $mru_header is optional.  Defaults to NULL
56
-     * @return SaveResult
57
-     */
58
-    public function create($sObjects, $type)
59
-    {
60
-        $arg = [];
61
-        foreach ($sObjects as $sObject) {
62
-            // FIX for fieldsToNull issue - allow array in fieldsToNull (STEP #1)
63
-            $xmlStr = '';
64
-            if (isset($sObject->fieldsToNull) && is_array($sObject->fieldsToNull)) {
65
-                foreach ($sObject->fieldsToNull as $fieldToNull) {
66
-                    $xmlStr .= '<fieldsToNull>' . $fieldToNull . '</fieldsToNull>';
67
-                }
68
-            }
69
-
70
-            $soapObject = new SoapVar($sObject, SOAP_ENC_OBJECT, $type, $this->namespace);
71
-
72
-            // FIX for fieldsToNull issue - allow array in fieldsToNull (STEP #2)
73
-            if ($xmlStr != '') {
74
-                $soapObject->enc_value->fieldsToNull = new SoapVar(new SoapVar($xmlStr, XSD_ANYXML), SOAP_ENC_ARRAY);
75
-            }
76
-            $arg[] = $soapObject;
77
-        }
78
-
79
-        return parent::_create(new SoapParam($arg, "sObjects"));
80
-    }
81
-
82
-    /**
83
-     * Updates one or more new individual objects to your organization's data.
84
-     * @param array sObjects    Array of sObjects
85
-     * @param AssignmentRuleHeader $assignment_header is optional.  Defaults to NULL
86
-     * @param MruHeader $mru_header is optional.  Defaults to NULL
87
-     * @return UpdateResult
88
-     */
89
-    public function update($sObjects, $type, $assignment_header = null, $mru_header = null)
90
-    {
91
-        $arg = new stdClass;
92
-        $arg->sObjects = [];
93
-        foreach ($sObjects as $sObject) {
94
-            // FIX for fieldsToNull issue - allow array in fieldsToNull (STEP #1)
95
-            $xmlStr = '';
96
-            if (isset($sObject->fieldsToNull) && is_array($sObject->fieldsToNull)) {
97
-                foreach ($sObject->fieldsToNull as $fieldToNull) {
98
-                    $xmlStr .= '<fieldsToNull>' . $fieldToNull . '</fieldsToNull>';
99
-                }
100
-            }
101
-
102
-            $soapObject = new SoapVar($sObject, SOAP_ENC_OBJECT, $type, $this->namespace);
103
-
104
-            // FIX for fieldsToNull issue - allow array in fieldsToNull (STEP #2)
105
-            if ($xmlStr != '') {
106
-                $soapObject->enc_value->fieldsToNull = new SoapVar(new SoapVar($xmlStr, XSD_ANYXML), SOAP_ENC_ARRAY);
107
-            }
108
-            $arg->sObjects[] = $soapObject;
109
-        }
110
-
111
-        return parent::_update($arg);
112
-    }
113
-
114
-    /**
115
-     * Creates new objects and updates existing objects; uses a custom field to
116
-     * determine the presence of existing objects. In most cases, we recommend
117
-     * that you use upsert instead of create because upsert is idempotent.
118
-     * Available in the API version 7.0 and later.
119
-     *
120
-     * @param string $ext_Id External Id
121
-     * @param array $sObjects Array of sObjects
122
-     * @param string $type The type of objects being upserted.
123
-     * @return UpsertResult
124
-     */
125
-    public function upsert($ext_Id, $sObjects, $type = 'Contact')
126
-    {
127
-        $arg = new stdClass;
128
-        $arg->sObjects = [];
129
-        $arg->externalIDFieldName = new SoapVar($ext_Id, XSD_STRING, 'string', 'http://www.w3.org/2001/XMLSchema');
130
-
131
-        foreach ($sObjects as $sObject) {
132
-            // FIX for fieldsToNull issue - allow array in fieldsToNull (STEP #1)
133
-            $xmlStr = '';
134
-            if (isset($sObject->fieldsToNull) && is_array($sObject->fieldsToNull)) {
135
-                foreach ($sObject->fieldsToNull as $fieldToNull) {
136
-                    $xmlStr .= '<fieldsToNull>' . $fieldToNull . '</fieldsToNull>';
137
-                }
138
-            }
139
-
140
-            $soapObject = new SoapVar($sObject, SOAP_ENC_OBJECT, $type, $this->namespace);
141
-
142
-            // FIX for fieldsToNull issue - allow array in fieldsToNull (STEP #2)
143
-            if ($xmlStr != '') {
144
-                $soapObject->enc_value->fieldsToNull = new SoapVar(new SoapVar($xmlStr, XSD_ANYXML), SOAP_ENC_ARRAY);
145
-            }
146
-            $arg->sObjects[] = $soapObject;
147
-        }
148
-
149
-        return parent::_upsert($arg);
150
-    }
151
-
152
-    /**
153
-     * Merge records
154
-     *
155
-     * @param stdclass $mergeRequest
156
-     * @param String $type
157
-     * @return unknown
158
-     */
159
-    public function merge($mergeRequest, $type)
160
-    {
161
-        $mergeRequest->masterRecord = new SoapVar($mergeRequest->masterRecord, SOAP_ENC_OBJECT, $type,
162
-            $this->namespace);
163
-        $arg = new stdClass;
164
-        $arg->request = new SoapVar($mergeRequest, SOAP_ENC_OBJECT, 'MergeRequest', $this->namespace);
165
-
166
-        return parent::_merge($arg);
167
-    }
44
+	const ENTERPRISE_NAMESPACE = 'urn:enterprise.soap.sforce.com';
45
+
46
+	public function __construct()
47
+	{
48
+		$this->namespace = self::ENTERPRISE_NAMESPACE;
49
+	}
50
+
51
+	/**
52
+	 * Adds one or more new individual objects to your organization's data.
53
+	 * @param array $sObjects Array of one or more sObjects (up to 200) to create.
54
+	 * @param AssignmentRuleHeader $assignment_header is optional.  Defaults to NULL
55
+	 * @param MruHeader $mru_header is optional.  Defaults to NULL
56
+	 * @return SaveResult
57
+	 */
58
+	public function create($sObjects, $type)
59
+	{
60
+		$arg = [];
61
+		foreach ($sObjects as $sObject) {
62
+			// FIX for fieldsToNull issue - allow array in fieldsToNull (STEP #1)
63
+			$xmlStr = '';
64
+			if (isset($sObject->fieldsToNull) && is_array($sObject->fieldsToNull)) {
65
+				foreach ($sObject->fieldsToNull as $fieldToNull) {
66
+					$xmlStr .= '<fieldsToNull>' . $fieldToNull . '</fieldsToNull>';
67
+				}
68
+			}
69
+
70
+			$soapObject = new SoapVar($sObject, SOAP_ENC_OBJECT, $type, $this->namespace);
71
+
72
+			// FIX for fieldsToNull issue - allow array in fieldsToNull (STEP #2)
73
+			if ($xmlStr != '') {
74
+				$soapObject->enc_value->fieldsToNull = new SoapVar(new SoapVar($xmlStr, XSD_ANYXML), SOAP_ENC_ARRAY);
75
+			}
76
+			$arg[] = $soapObject;
77
+		}
78
+
79
+		return parent::_create(new SoapParam($arg, "sObjects"));
80
+	}
81
+
82
+	/**
83
+	 * Updates one or more new individual objects to your organization's data.
84
+	 * @param array sObjects    Array of sObjects
85
+	 * @param AssignmentRuleHeader $assignment_header is optional.  Defaults to NULL
86
+	 * @param MruHeader $mru_header is optional.  Defaults to NULL
87
+	 * @return UpdateResult
88
+	 */
89
+	public function update($sObjects, $type, $assignment_header = null, $mru_header = null)
90
+	{
91
+		$arg = new stdClass;
92
+		$arg->sObjects = [];
93
+		foreach ($sObjects as $sObject) {
94
+			// FIX for fieldsToNull issue - allow array in fieldsToNull (STEP #1)
95
+			$xmlStr = '';
96
+			if (isset($sObject->fieldsToNull) && is_array($sObject->fieldsToNull)) {
97
+				foreach ($sObject->fieldsToNull as $fieldToNull) {
98
+					$xmlStr .= '<fieldsToNull>' . $fieldToNull . '</fieldsToNull>';
99
+				}
100
+			}
101
+
102
+			$soapObject = new SoapVar($sObject, SOAP_ENC_OBJECT, $type, $this->namespace);
103
+
104
+			// FIX for fieldsToNull issue - allow array in fieldsToNull (STEP #2)
105
+			if ($xmlStr != '') {
106
+				$soapObject->enc_value->fieldsToNull = new SoapVar(new SoapVar($xmlStr, XSD_ANYXML), SOAP_ENC_ARRAY);
107
+			}
108
+			$arg->sObjects[] = $soapObject;
109
+		}
110
+
111
+		return parent::_update($arg);
112
+	}
113
+
114
+	/**
115
+	 * Creates new objects and updates existing objects; uses a custom field to
116
+	 * determine the presence of existing objects. In most cases, we recommend
117
+	 * that you use upsert instead of create because upsert is idempotent.
118
+	 * Available in the API version 7.0 and later.
119
+	 *
120
+	 * @param string $ext_Id External Id
121
+	 * @param array $sObjects Array of sObjects
122
+	 * @param string $type The type of objects being upserted.
123
+	 * @return UpsertResult
124
+	 */
125
+	public function upsert($ext_Id, $sObjects, $type = 'Contact')
126
+	{
127
+		$arg = new stdClass;
128
+		$arg->sObjects = [];
129
+		$arg->externalIDFieldName = new SoapVar($ext_Id, XSD_STRING, 'string', 'http://www.w3.org/2001/XMLSchema');
130
+
131
+		foreach ($sObjects as $sObject) {
132
+			// FIX for fieldsToNull issue - allow array in fieldsToNull (STEP #1)
133
+			$xmlStr = '';
134
+			if (isset($sObject->fieldsToNull) && is_array($sObject->fieldsToNull)) {
135
+				foreach ($sObject->fieldsToNull as $fieldToNull) {
136
+					$xmlStr .= '<fieldsToNull>' . $fieldToNull . '</fieldsToNull>';
137
+				}
138
+			}
139
+
140
+			$soapObject = new SoapVar($sObject, SOAP_ENC_OBJECT, $type, $this->namespace);
141
+
142
+			// FIX for fieldsToNull issue - allow array in fieldsToNull (STEP #2)
143
+			if ($xmlStr != '') {
144
+				$soapObject->enc_value->fieldsToNull = new SoapVar(new SoapVar($xmlStr, XSD_ANYXML), SOAP_ENC_ARRAY);
145
+			}
146
+			$arg->sObjects[] = $soapObject;
147
+		}
148
+
149
+		return parent::_upsert($arg);
150
+	}
151
+
152
+	/**
153
+	 * Merge records
154
+	 *
155
+	 * @param stdclass $mergeRequest
156
+	 * @param String $type
157
+	 * @return unknown
158
+	 */
159
+	public function merge($mergeRequest, $type)
160
+	{
161
+		$mergeRequest->masterRecord = new SoapVar($mergeRequest->masterRecord, SOAP_ENC_OBJECT, $type,
162
+			$this->namespace);
163
+		$arg = new stdClass;
164
+		$arg->request = new SoapVar($mergeRequest, SOAP_ENC_OBJECT, 'MergeRequest', $this->namespace);
165
+
166
+		return parent::_merge($arg);
167
+	}
168 168
 }
169 169
 
170 170
 ?>
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
             $xmlStr = '';
64 64
             if (isset($sObject->fieldsToNull) && is_array($sObject->fieldsToNull)) {
65 65
                 foreach ($sObject->fieldsToNull as $fieldToNull) {
66
-                    $xmlStr .= '<fieldsToNull>' . $fieldToNull . '</fieldsToNull>';
66
+                    $xmlStr .= '<fieldsToNull>'.$fieldToNull.'</fieldsToNull>';
67 67
                 }
68 68
             }
69 69
 
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
             $xmlStr = '';
96 96
             if (isset($sObject->fieldsToNull) && is_array($sObject->fieldsToNull)) {
97 97
                 foreach ($sObject->fieldsToNull as $fieldToNull) {
98
-                    $xmlStr .= '<fieldsToNull>' . $fieldToNull . '</fieldsToNull>';
98
+                    $xmlStr .= '<fieldsToNull>'.$fieldToNull.'</fieldsToNull>';
99 99
                 }
100 100
             }
101 101
 
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
             $xmlStr = '';
134 134
             if (isset($sObject->fieldsToNull) && is_array($sObject->fieldsToNull)) {
135 135
                 foreach ($sObject->fieldsToNull as $fieldToNull) {
136
-                    $xmlStr .= '<fieldsToNull>' . $fieldToNull . '</fieldsToNull>';
136
+                    $xmlStr .= '<fieldsToNull>'.$fieldToNull.'</fieldsToNull>';
137 137
                 }
138 138
             }
139 139
 
Please login to merge, or discard this patch.
src/Davispeixoto/ForceDotComToolkitForPhp/SforcePartnerClient.php 3 patches
Doc Comments   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -68,7 +68,6 @@  discard block
 block discarded – undo
68 68
      * Merge records
69 69
      *
70 70
      * @param stdclass $mergeRequest
71
-     * @param String $type
72 71
      * @return mixed
73 72
      */
74 73
     public function merge($mergeRequest)
@@ -184,7 +183,7 @@  discard block
 block discarded – undo
184 183
 
185 184
     /**
186 185
      *
187
-     * @param mixed $response
186
+     * @param SObject[] $response
188 187
      * @return array
189 188
      */
190 189
     private function _retrieveResult($response)
Please login to merge, or discard this patch.
Indentation   +169 added lines, -169 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php namespace Davispeixoto\ForceDotComToolkitForPhp;
2 2
 
3
-    /*
3
+	/*
4 4
      * Copyright (c) 2007, salesforce.com, inc.
5 5
      * All rights reserved.
6 6
      *
@@ -34,173 +34,173 @@  discard block
 block discarded – undo
34 34
  */
35 35
 class SforcePartnerClient extends SforceBaseClient
36 36
 {
37
-    const PARTNER_NAMESPACE = 'urn:partner.soap.sforce.com';
38
-
39
-    function SforcePartnerClient()
40
-    {
41
-        $this->namespace = self::PARTNER_NAMESPACE;
42
-    }
43
-
44
-    protected function getSoapClient($wsdl, $options)
45
-    {
46
-        return new SforceSoapClient($wsdl, $options);
47
-    }
48
-
49
-    /**
50
-     * Adds one or more new individual objects to your organization's data.
51
-     * @param array $sObjects Array of one or more sObjects (up to 200) to create.
52
-     * @return SaveResult
53
-     */
54
-    public function create($sObjects)
55
-    {
56
-        $arg = new stdClass;
57
-        foreach ($sObjects as $sObject) {
58
-            if (isset ($sObject->fields)) {
59
-                $sObject->any = $this->_convertToAny($sObject->fields);
60
-            }
61
-        }
62
-        $arg->sObjects = $sObjects;
63
-
64
-        return parent::_create($arg);
65
-    }
66
-
67
-    /**
68
-     * Merge records
69
-     *
70
-     * @param stdclass $mergeRequest
71
-     * @param String $type
72
-     * @return mixed
73
-     */
74
-    public function merge($mergeRequest)
75
-    {
76
-        if (isset($mergeRequest->masterRecord)) {
77
-            if (isset($mergeRequest->masterRecord->fields)) {
78
-                $mergeRequest->masterRecord->any = $this->_convertToAny($mergeRequest->masterRecord->fields);
79
-            }
80
-            $arg = new stdClass();
81
-            $arg->request = $mergeRequest;
82
-
83
-            return $this->_merge($arg);
84
-        }
85
-    }
86
-
87
-    /**
88
-     *
89
-     * @param array $request
90
-     */
91
-    public function sendSingleEmail($request)
92
-    {
93
-        if (is_array($request)) {
94
-            $messages = array();
95
-            foreach ($request as $r) {
96
-                $email = new \SoapVar($r, SOAP_ENC_OBJECT, 'SingleEmailMessage', $this->namespace);
97
-                array_push($messages, $email);
98
-            }
99
-            $arg->messages = $messages;
100
-
101
-            return parent::_sendEmail($arg);
102
-        } else {
103
-            $backtrace = debug_backtrace();
104
-            error_log('Please pass in array to this function:  ' . $backtrace[0]['function']);
105
-            return false;
106
-        }
107
-    }
108
-
109
-    /**
110
-     *
111
-     * @param array $request
112
-     */
113
-    public function sendMassEmail($request)
114
-    {
115
-        $arg = new stdClass();
116
-        if (is_array($request)) {
117
-            $messages = array();
118
-            foreach ($request as $r) {
119
-                $email = new \SoapVar($r, SOAP_ENC_OBJECT, 'MassEmailMessage', $this->namespace);
120
-                array_push($messages, $email);
121
-            }
122
-            $arg->messages = $messages;
123
-
124
-            return parent::_sendEmail($arg);
125
-        } else {
126
-            $backtrace = debug_backtrace();
127
-            error_log('Please pass in array to this function:  ' . $backtrace[0]['function']);
128
-            return false;
129
-        }
130
-    }
131
-
132
-    /**
133
-     * Updates one or more new individual objects to your organization's data.
134
-     * @param array sObjects    Array of sObjects
135
-     * @return UpdateResult
136
-     */
137
-    public function update($sObjects)
138
-    {
139
-        $arg = new stdClass;
140
-        foreach ($sObjects as $sObject) {
141
-            if (isset($sObject->fields)) {
142
-                $sObject->any = $this->_convertToAny($sObject->fields);
143
-            }
144
-        }
145
-        $arg->sObjects = $sObjects;
146
-
147
-        return parent::_update($arg);
148
-    }
149
-
150
-    /**
151
-     * Creates new objects and updates existing objects; uses a custom field to
152
-     * determine the presence of existing objects. In most cases, we recommend
153
-     * that you use upsert instead of create because upsert is idempotent.
154
-     * Available in the API version 7.0 and later.
155
-     *
156
-     * @param string $ext_Id External Id
157
-     * @param array $sObjects Array of sObjects
158
-     * @return UpsertResult
159
-     */
160
-    public function upsert($ext_Id, $sObjects)
161
-    {
162
-        $arg = new stdClass;
163
-        $arg->externalIDFieldName = new \SoapVar($ext_Id, XSD_STRING, 'string', 'http://www.w3.org/2001/XMLSchema');
164
-        foreach ($sObjects as $sObject) {
165
-            if (isset ($sObject->fields)) {
166
-                $sObject->any = $this->_convertToAny($sObject->fields);
167
-            }
168
-        }
169
-        $arg->sObjects = $sObjects;
170
-
171
-        return parent::_upsert($arg);
172
-    }
173
-
174
-    /**
175
-     * @param string $fieldList
176
-     * @param string $sObjectType
177
-     * @param array $ids
178
-     * @return string
179
-     */
180
-    public function retrieve($fieldList, $sObjectType, $ids)
181
-    {
182
-        return $this->_retrieveResult(parent::retrieve($fieldList, $sObjectType, $ids));
183
-    }
184
-
185
-    /**
186
-     *
187
-     * @param mixed $response
188
-     * @return array
189
-     */
190
-    private function _retrieveResult($response)
191
-    {
192
-        $arr = array();
193
-        if (is_array($response)) {
194
-            foreach ($response as $r) {
195
-                $sobject = new SObject($r);
196
-                array_push($arr, $sobject);
197
-            }
198
-        } else {
199
-            $sobject = new SObject($response);
200
-            array_push($arr, $sobject);
201
-        }
202
-
203
-        return $arr;
204
-    }
37
+	const PARTNER_NAMESPACE = 'urn:partner.soap.sforce.com';
38
+
39
+	function SforcePartnerClient()
40
+	{
41
+		$this->namespace = self::PARTNER_NAMESPACE;
42
+	}
43
+
44
+	protected function getSoapClient($wsdl, $options)
45
+	{
46
+		return new SforceSoapClient($wsdl, $options);
47
+	}
48
+
49
+	/**
50
+	 * Adds one or more new individual objects to your organization's data.
51
+	 * @param array $sObjects Array of one or more sObjects (up to 200) to create.
52
+	 * @return SaveResult
53
+	 */
54
+	public function create($sObjects)
55
+	{
56
+		$arg = new stdClass;
57
+		foreach ($sObjects as $sObject) {
58
+			if (isset ($sObject->fields)) {
59
+				$sObject->any = $this->_convertToAny($sObject->fields);
60
+			}
61
+		}
62
+		$arg->sObjects = $sObjects;
63
+
64
+		return parent::_create($arg);
65
+	}
66
+
67
+	/**
68
+	 * Merge records
69
+	 *
70
+	 * @param stdclass $mergeRequest
71
+	 * @param String $type
72
+	 * @return mixed
73
+	 */
74
+	public function merge($mergeRequest)
75
+	{
76
+		if (isset($mergeRequest->masterRecord)) {
77
+			if (isset($mergeRequest->masterRecord->fields)) {
78
+				$mergeRequest->masterRecord->any = $this->_convertToAny($mergeRequest->masterRecord->fields);
79
+			}
80
+			$arg = new stdClass();
81
+			$arg->request = $mergeRequest;
82
+
83
+			return $this->_merge($arg);
84
+		}
85
+	}
86
+
87
+	/**
88
+	 *
89
+	 * @param array $request
90
+	 */
91
+	public function sendSingleEmail($request)
92
+	{
93
+		if (is_array($request)) {
94
+			$messages = array();
95
+			foreach ($request as $r) {
96
+				$email = new \SoapVar($r, SOAP_ENC_OBJECT, 'SingleEmailMessage', $this->namespace);
97
+				array_push($messages, $email);
98
+			}
99
+			$arg->messages = $messages;
100
+
101
+			return parent::_sendEmail($arg);
102
+		} else {
103
+			$backtrace = debug_backtrace();
104
+			error_log('Please pass in array to this function:  ' . $backtrace[0]['function']);
105
+			return false;
106
+		}
107
+	}
108
+
109
+	/**
110
+	 *
111
+	 * @param array $request
112
+	 */
113
+	public function sendMassEmail($request)
114
+	{
115
+		$arg = new stdClass();
116
+		if (is_array($request)) {
117
+			$messages = array();
118
+			foreach ($request as $r) {
119
+				$email = new \SoapVar($r, SOAP_ENC_OBJECT, 'MassEmailMessage', $this->namespace);
120
+				array_push($messages, $email);
121
+			}
122
+			$arg->messages = $messages;
123
+
124
+			return parent::_sendEmail($arg);
125
+		} else {
126
+			$backtrace = debug_backtrace();
127
+			error_log('Please pass in array to this function:  ' . $backtrace[0]['function']);
128
+			return false;
129
+		}
130
+	}
131
+
132
+	/**
133
+	 * Updates one or more new individual objects to your organization's data.
134
+	 * @param array sObjects    Array of sObjects
135
+	 * @return UpdateResult
136
+	 */
137
+	public function update($sObjects)
138
+	{
139
+		$arg = new stdClass;
140
+		foreach ($sObjects as $sObject) {
141
+			if (isset($sObject->fields)) {
142
+				$sObject->any = $this->_convertToAny($sObject->fields);
143
+			}
144
+		}
145
+		$arg->sObjects = $sObjects;
146
+
147
+		return parent::_update($arg);
148
+	}
149
+
150
+	/**
151
+	 * Creates new objects and updates existing objects; uses a custom field to
152
+	 * determine the presence of existing objects. In most cases, we recommend
153
+	 * that you use upsert instead of create because upsert is idempotent.
154
+	 * Available in the API version 7.0 and later.
155
+	 *
156
+	 * @param string $ext_Id External Id
157
+	 * @param array $sObjects Array of sObjects
158
+	 * @return UpsertResult
159
+	 */
160
+	public function upsert($ext_Id, $sObjects)
161
+	{
162
+		$arg = new stdClass;
163
+		$arg->externalIDFieldName = new \SoapVar($ext_Id, XSD_STRING, 'string', 'http://www.w3.org/2001/XMLSchema');
164
+		foreach ($sObjects as $sObject) {
165
+			if (isset ($sObject->fields)) {
166
+				$sObject->any = $this->_convertToAny($sObject->fields);
167
+			}
168
+		}
169
+		$arg->sObjects = $sObjects;
170
+
171
+		return parent::_upsert($arg);
172
+	}
173
+
174
+	/**
175
+	 * @param string $fieldList
176
+	 * @param string $sObjectType
177
+	 * @param array $ids
178
+	 * @return string
179
+	 */
180
+	public function retrieve($fieldList, $sObjectType, $ids)
181
+	{
182
+		return $this->_retrieveResult(parent::retrieve($fieldList, $sObjectType, $ids));
183
+	}
184
+
185
+	/**
186
+	 *
187
+	 * @param mixed $response
188
+	 * @return array
189
+	 */
190
+	private function _retrieveResult($response)
191
+	{
192
+		$arr = array();
193
+		if (is_array($response)) {
194
+			foreach ($response as $r) {
195
+				$sobject = new SObject($r);
196
+				array_push($arr, $sobject);
197
+			}
198
+		} else {
199
+			$sobject = new SObject($response);
200
+			array_push($arr, $sobject);
201
+		}
202
+
203
+		return $arr;
204
+	}
205 205
 
206 206
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
             return parent::_sendEmail($arg);
102 102
         } else {
103 103
             $backtrace = debug_backtrace();
104
-            error_log('Please pass in array to this function:  ' . $backtrace[0]['function']);
104
+            error_log('Please pass in array to this function:  '.$backtrace[0]['function']);
105 105
             return false;
106 106
         }
107 107
     }
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
             return parent::_sendEmail($arg);
125 125
         } else {
126 126
             $backtrace = debug_backtrace();
127
-            error_log('Please pass in array to this function:  ' . $backtrace[0]['function']);
127
+            error_log('Please pass in array to this function:  '.$backtrace[0]['function']);
128 128
             return false;
129 129
         }
130 130
     }
Please login to merge, or discard this patch.
src/Davispeixoto/ForceDotComToolkitForPhp/SObject.php 3 patches
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -284,6 +284,10 @@
 block discarded – undo
284 284
     /*
285 285
      * If the stdClass has a type, we know it is an SObject
286 286
     */
287
+
288
+    /**
289
+     * @param stdClass $param
290
+     */
287 291
     public function isSObject($param)
288 292
     {
289 293
         return isset($param->type);
Please login to merge, or discard this patch.
Indentation   +252 added lines, -252 removed lines patch added patch discarded remove patch
@@ -31,263 +31,263 @@
 block discarded – undo
31 31
 
32 32
 class SObject
33 33
 {
34
-    public $type;
35
-    public $fields;
36
-
37
-    //	public $sobject;
38
-
39
-    public function __construct($response = null)
40
-    {
41
-        if (!isset($response) && !$response) {
42
-            return;
43
-        }
44
-
45
-        foreach ($response as $responseKey => $responseValue) {
46
-            if (in_array($responseKey, array('Id', 'type', 'any'))) {
47
-                continue;
48
-            }
49
-            $this->$responseKey = $responseValue;
50
-        }
51
-
52
-        if (isset($response->Id)) {
53
-            $this->Id = is_array($response->Id) ? $response->Id[0] : $response->Id;
54
-        }
55
-
56
-        if (isset($response->type)) {
57
-            $this->type = $response->type;
58
-        }
59
-
60
-        if (isset($response->any)) {
61
-            try {
62
-                if ($response->any instanceof stdClass) {
63
-                    if ($this->isSObject($response->any)) {
64
-                        $anArray = array();
65
-                        $sobject = new SObject($response->any);
66
-                        $anArray[] = $sobject;
67
-                        $this->sobjects = $anArray;
68
-                    } else {
69
-                        $this->queryResult = new QueryResult($response->any);
70
-                    }
71
-                } else {
72
-                    if (is_array($response->any)) {
73
-                        $anArray = array();
74
-                        foreach ($response->any as $key => $item) {
75
-                            if ($item instanceof stdClass) {
76
-                                if ($this->isSObject($item)) {
77
-                                    $sobject = new SObject($item);
78
-                                    $anArray[$key] = $sobject;
79
-                                } else {
80
-                                    if (!isset($this->queryResult)) {
81
-                                        $this->queryResult = array();
82
-                                    }
83
-                                    array_push($this->queryResult, new QueryResult($item));
84
-                                }
85
-                            } else {
86
-                                if (strpos($item, 'sf:') === false) {
87
-                                    $currentXmlValue = sprintf('<sf:%s>%s</sf:%s>', $key, $item, $key);
88
-                                } else {
89
-                                    $currentXmlValue = $item;
90
-                                }
91
-
92
-                                if (!isset($fieldsToConvert)) {
93
-                                    $fieldsToConvert = $currentXmlValue;
94
-                                } else {
95
-                                    $fieldsToConvert .= $currentXmlValue;
96
-                                }
97
-                            }
98
-                        }
99
-
100
-                        if (isset($fieldsToConvert)) {
101
-                            $this->fields = $this->convertFields($fieldsToConvert);
102
-                        }
103
-
104
-                        if (sizeof($anArray) > 0) {
105
-                            foreach ($anArray as $key => $children_sobject) {
106
-                                $this->fields->$key = $children_sobject;
107
-                            }
108
-                        }
109
-                    } else {
110
-                        $this->fields = $this->convertFields($response->any);
111
-                    }
112
-                }
113
-            } catch (Exception $e) {
114
-                error_log('salesforce exception: ', $e->getMessage());
115
-                error_log('salesforce exception: ', $e->getTraceAsString());
116
-            }
117
-        }
118
-    }
119
-
120
-    public function __get($name)
121
-    {
122
-        return (isset($this->fields->$name)) ? $this->fields->$name : false;
123
-    }
124
-
125
-    public function __isset($name)
126
-    {
127
-        return isset($this->fields->$name);
128
-    }
129
-
130
-    /**
131
-     * Parse the "any" string from an sObject.  First strip out the sf: and then
132
-     * enclose string with <Object></Object>.  Load the string using
133
-     * simplexml_load_string and return an array that can be traversed.
134
-     */
135
-    public function convertFields($any)
136
-    {
137
-        $str = preg_replace('{sf:}', '', $any);
138
-
139
-        $array = $this->xml2array('<Object xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">' . $str . '</Object>',
140
-            2);
141
-
142
-        $xml = new stdClass();
143
-        if (!count($array['Object'])) {
144
-            return $xml;
145
-        }
146
-
147
-        foreach ($array['Object'] as $k => $v) {
148
-            $xml->$k = $v;
149
-        }
150
-
151
-        return $xml;
152
-    }
153
-
154
-    /**
155
-     *
156
-     * @param string $contents
157
-     * @return array
158
-     */
159
-    public function xml2array($contents, $get_attributes = 1)
160
-    {
161
-        if (!$contents) {
162
-            return array();
163
-        }
164
-
165
-        if (!function_exists('xml_parser_create')) {
166
-            return array('not found');
167
-        }
168
-
169
-        $parser = xml_parser_create();
170
-        xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);
171
-        xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
172
-        xml_parse_into_struct($parser, $contents, $xml_values);
173
-        xml_parser_free($parser);
174
-
175
-        if (!$xml_values) {
176
-            return;
177
-        }
178
-
179
-        //Initializations
180
-        $xml_array = array();
181
-        $parents = array();
182
-        $opened_tags = array();
183
-        $arr = array();
184
-
185
-        $current = &$xml_array;
186
-
187
-        foreach ($xml_values as $data) {
188
-            unset($attributes, $value);//Remove existing values, or there will be trouble
189
-
190
-            //This command will extract these variables into the foreach scope
191
-            // tag(string), type(string), level(int), attributes(array).
192
-            extract($data);//We could use the array by itself, but this cooler.
193
-
194
-            $result = '';
195
-            if ($get_attributes) {
196
-                switch ($get_attributes) {
197
-                    case 1:
198
-                        $result = array();
199
-                        if (isset($value)) {
200
-                            $result['value'] = $value;
201
-                        }
202
-
203
-                        //Set the attributes too.
204
-                        if (isset($attributes)) {
205
-                            foreach ($attributes as $attr => $val) {
206
-                                if ($get_attributes == 1) {
207
-                                    $result['attr'][$attr] = $val;
208
-                                } //Set all the attributes in a array called 'attr'
209
-                                /**  :TODO: should we change the key name to '_attr'? Someone may use the tagname 'attr'. Same goes for 'value' too */
210
-                            }
211
-                        }
212
-                        break;
213
-
214
-                    case 2:
215
-                        $result = array();
216
-                        if (isset($value)) {
217
-                            $result = $value;
218
-                        }
219
-
220
-                        //Check for nil and ignore other attributes.
221
-                        if (isset($attributes) && isset($attributes['xsi:nil']) && !strcasecmp($attributes['xsi:nil'],
222
-                                'true')
223
-                        ) {
224
-                            $result = null;
225
-                        }
226
-                        break;
227
-                }
228
-            } elseif (isset($value)) {
229
-                $result = $value;
230
-            }
231
-
232
-            //See tag status and do the needed.
233
-            if ($type == "open") {//The starting of the tag '<tag>'
234
-                $parent[$level - 1] = &$current;
235
-
236
-                if (!is_array($current) || (!in_array($tag, array_keys($current)))) { //Insert New tag
237
-                    $current[$tag] = $result;
238
-                    $current = &$current[$tag];
239
-
240
-                } else { //There was another element with the same tag name
241
-                    if (isset($current[$tag][0])) {
242
-                        array_push($current[$tag], $result);
243
-                    } else {
244
-                        $current[$tag] = array($current[$tag], $result);
245
-                    }
246
-                    $last = count($current[$tag]) - 1;
247
-                    $current = &$current[$tag][$last];
248
-                }
249
-
250
-            } elseif ($type == "complete") { //Tags that ends in 1 line '<tag />'
251
-                //See if the key is already taken.
252
-                if (!isset($current[$tag])) { //New Key
253
-                    $current[$tag] = $result;
254
-
255
-                } else { //If taken, put all things inside a list(array)
256
-                    if ((is_array($current[$tag]) && $get_attributes == 0)//If it is already an array...
257
-                        || (isset($current[$tag][0]) && is_array($current[$tag][0]) && ($get_attributes == 1 || $get_attributes == 2))
258
-                    ) {
259
-                        array_push($current[$tag], $result); // ...push the new element into that array.
260
-                    } else { //If it is not an array...
261
-                        $current[$tag] = array(
262
-                            $current[$tag],
263
-                            $result
264
-                        ); //...Make it an array using using the existing value and the new value
265
-                    }
266
-                }
267
-
268
-            } elseif ($type == 'close') { //End of tag '</tag>'
269
-                $current = &$parent[$level - 1];
270
-            }
271
-        }
272
-
273
-        return ($xml_array);
274
-    }
275
-
276
-    /*
34
+	public $type;
35
+	public $fields;
36
+
37
+	//	public $sobject;
38
+
39
+	public function __construct($response = null)
40
+	{
41
+		if (!isset($response) && !$response) {
42
+			return;
43
+		}
44
+
45
+		foreach ($response as $responseKey => $responseValue) {
46
+			if (in_array($responseKey, array('Id', 'type', 'any'))) {
47
+				continue;
48
+			}
49
+			$this->$responseKey = $responseValue;
50
+		}
51
+
52
+		if (isset($response->Id)) {
53
+			$this->Id = is_array($response->Id) ? $response->Id[0] : $response->Id;
54
+		}
55
+
56
+		if (isset($response->type)) {
57
+			$this->type = $response->type;
58
+		}
59
+
60
+		if (isset($response->any)) {
61
+			try {
62
+				if ($response->any instanceof stdClass) {
63
+					if ($this->isSObject($response->any)) {
64
+						$anArray = array();
65
+						$sobject = new SObject($response->any);
66
+						$anArray[] = $sobject;
67
+						$this->sobjects = $anArray;
68
+					} else {
69
+						$this->queryResult = new QueryResult($response->any);
70
+					}
71
+				} else {
72
+					if (is_array($response->any)) {
73
+						$anArray = array();
74
+						foreach ($response->any as $key => $item) {
75
+							if ($item instanceof stdClass) {
76
+								if ($this->isSObject($item)) {
77
+									$sobject = new SObject($item);
78
+									$anArray[$key] = $sobject;
79
+								} else {
80
+									if (!isset($this->queryResult)) {
81
+										$this->queryResult = array();
82
+									}
83
+									array_push($this->queryResult, new QueryResult($item));
84
+								}
85
+							} else {
86
+								if (strpos($item, 'sf:') === false) {
87
+									$currentXmlValue = sprintf('<sf:%s>%s</sf:%s>', $key, $item, $key);
88
+								} else {
89
+									$currentXmlValue = $item;
90
+								}
91
+
92
+								if (!isset($fieldsToConvert)) {
93
+									$fieldsToConvert = $currentXmlValue;
94
+								} else {
95
+									$fieldsToConvert .= $currentXmlValue;
96
+								}
97
+							}
98
+						}
99
+
100
+						if (isset($fieldsToConvert)) {
101
+							$this->fields = $this->convertFields($fieldsToConvert);
102
+						}
103
+
104
+						if (sizeof($anArray) > 0) {
105
+							foreach ($anArray as $key => $children_sobject) {
106
+								$this->fields->$key = $children_sobject;
107
+							}
108
+						}
109
+					} else {
110
+						$this->fields = $this->convertFields($response->any);
111
+					}
112
+				}
113
+			} catch (Exception $e) {
114
+				error_log('salesforce exception: ', $e->getMessage());
115
+				error_log('salesforce exception: ', $e->getTraceAsString());
116
+			}
117
+		}
118
+	}
119
+
120
+	public function __get($name)
121
+	{
122
+		return (isset($this->fields->$name)) ? $this->fields->$name : false;
123
+	}
124
+
125
+	public function __isset($name)
126
+	{
127
+		return isset($this->fields->$name);
128
+	}
129
+
130
+	/**
131
+	 * Parse the "any" string from an sObject.  First strip out the sf: and then
132
+	 * enclose string with <Object></Object>.  Load the string using
133
+	 * simplexml_load_string and return an array that can be traversed.
134
+	 */
135
+	public function convertFields($any)
136
+	{
137
+		$str = preg_replace('{sf:}', '', $any);
138
+
139
+		$array = $this->xml2array('<Object xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">' . $str . '</Object>',
140
+			2);
141
+
142
+		$xml = new stdClass();
143
+		if (!count($array['Object'])) {
144
+			return $xml;
145
+		}
146
+
147
+		foreach ($array['Object'] as $k => $v) {
148
+			$xml->$k = $v;
149
+		}
150
+
151
+		return $xml;
152
+	}
153
+
154
+	/**
155
+	 *
156
+	 * @param string $contents
157
+	 * @return array
158
+	 */
159
+	public function xml2array($contents, $get_attributes = 1)
160
+	{
161
+		if (!$contents) {
162
+			return array();
163
+		}
164
+
165
+		if (!function_exists('xml_parser_create')) {
166
+			return array('not found');
167
+		}
168
+
169
+		$parser = xml_parser_create();
170
+		xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);
171
+		xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
172
+		xml_parse_into_struct($parser, $contents, $xml_values);
173
+		xml_parser_free($parser);
174
+
175
+		if (!$xml_values) {
176
+			return;
177
+		}
178
+
179
+		//Initializations
180
+		$xml_array = array();
181
+		$parents = array();
182
+		$opened_tags = array();
183
+		$arr = array();
184
+
185
+		$current = &$xml_array;
186
+
187
+		foreach ($xml_values as $data) {
188
+			unset($attributes, $value);//Remove existing values, or there will be trouble
189
+
190
+			//This command will extract these variables into the foreach scope
191
+			// tag(string), type(string), level(int), attributes(array).
192
+			extract($data);//We could use the array by itself, but this cooler.
193
+
194
+			$result = '';
195
+			if ($get_attributes) {
196
+				switch ($get_attributes) {
197
+					case 1:
198
+						$result = array();
199
+						if (isset($value)) {
200
+							$result['value'] = $value;
201
+						}
202
+
203
+						//Set the attributes too.
204
+						if (isset($attributes)) {
205
+							foreach ($attributes as $attr => $val) {
206
+								if ($get_attributes == 1) {
207
+									$result['attr'][$attr] = $val;
208
+								} //Set all the attributes in a array called 'attr'
209
+								/**  :TODO: should we change the key name to '_attr'? Someone may use the tagname 'attr'. Same goes for 'value' too */
210
+							}
211
+						}
212
+						break;
213
+
214
+					case 2:
215
+						$result = array();
216
+						if (isset($value)) {
217
+							$result = $value;
218
+						}
219
+
220
+						//Check for nil and ignore other attributes.
221
+						if (isset($attributes) && isset($attributes['xsi:nil']) && !strcasecmp($attributes['xsi:nil'],
222
+								'true')
223
+						) {
224
+							$result = null;
225
+						}
226
+						break;
227
+				}
228
+			} elseif (isset($value)) {
229
+				$result = $value;
230
+			}
231
+
232
+			//See tag status and do the needed.
233
+			if ($type == "open") {//The starting of the tag '<tag>'
234
+				$parent[$level - 1] = &$current;
235
+
236
+				if (!is_array($current) || (!in_array($tag, array_keys($current)))) { //Insert New tag
237
+					$current[$tag] = $result;
238
+					$current = &$current[$tag];
239
+
240
+				} else { //There was another element with the same tag name
241
+					if (isset($current[$tag][0])) {
242
+						array_push($current[$tag], $result);
243
+					} else {
244
+						$current[$tag] = array($current[$tag], $result);
245
+					}
246
+					$last = count($current[$tag]) - 1;
247
+					$current = &$current[$tag][$last];
248
+				}
249
+
250
+			} elseif ($type == "complete") { //Tags that ends in 1 line '<tag />'
251
+				//See if the key is already taken.
252
+				if (!isset($current[$tag])) { //New Key
253
+					$current[$tag] = $result;
254
+
255
+				} else { //If taken, put all things inside a list(array)
256
+					if ((is_array($current[$tag]) && $get_attributes == 0)//If it is already an array...
257
+						|| (isset($current[$tag][0]) && is_array($current[$tag][0]) && ($get_attributes == 1 || $get_attributes == 2))
258
+					) {
259
+						array_push($current[$tag], $result); // ...push the new element into that array.
260
+					} else { //If it is not an array...
261
+						$current[$tag] = array(
262
+							$current[$tag],
263
+							$result
264
+						); //...Make it an array using using the existing value and the new value
265
+					}
266
+				}
267
+
268
+			} elseif ($type == 'close') { //End of tag '</tag>'
269
+				$current = &$parent[$level - 1];
270
+			}
271
+		}
272
+
273
+		return ($xml_array);
274
+	}
275
+
276
+	/*
277 277
      * If the stdClass has a done, we know it is a QueryResult
278 278
     */
279
-    public function isQueryResult($param)
280
-    {
281
-        return isset($param->done);
282
-    }
279
+	public function isQueryResult($param)
280
+	{
281
+		return isset($param->done);
282
+	}
283 283
 
284
-    /*
284
+	/*
285 285
      * If the stdClass has a type, we know it is an SObject
286 286
     */
287
-    public function isSObject($param)
288
-    {
289
-        return isset($param->type);
290
-    }
287
+	public function isSObject($param)
288
+	{
289
+		return isset($param->type);
290
+	}
291 291
 }
292 292
 
293 293
 ?>
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
     {
137 137
         $str = preg_replace('{sf:}', '', $any);
138 138
 
139
-        $array = $this->xml2array('<Object xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">' . $str . '</Object>',
139
+        $array = $this->xml2array('<Object xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">'.$str.'</Object>',
140 140
             2);
141 141
 
142 142
         $xml = new stdClass();
@@ -185,11 +185,11 @@  discard block
 block discarded – undo
185 185
         $current = &$xml_array;
186 186
 
187 187
         foreach ($xml_values as $data) {
188
-            unset($attributes, $value);//Remove existing values, or there will be trouble
188
+            unset($attributes, $value); //Remove existing values, or there will be trouble
189 189
 
190 190
             //This command will extract these variables into the foreach scope
191 191
             // tag(string), type(string), level(int), attributes(array).
192
-            extract($data);//We could use the array by itself, but this cooler.
192
+            extract($data); //We could use the array by itself, but this cooler.
193 193
 
194 194
             $result = '';
195 195
             if ($get_attributes) {
Please login to merge, or discard this patch.
src/Davispeixoto/ForceDotComToolkitForPhp/PackageVersionHeader.php 1 patch
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -28,21 +28,21 @@
 block discarded – undo
28 28
 
29 29
 class PackageVersionHeader
30 30
 {
31
-    /**
32
-     * @var array $packageVersions
33
-     */
34
-    public $packageVersions;
31
+	/**
32
+	 * @var array $packageVersions
33
+	 */
34
+	public $packageVersions;
35 35
 
36
-    /**
37
-     * Class constructor.
38
-     *
39
-     * @param array $packageVersions
40
-     * @return void
41
-     */
42
-    public function __construct($packageVersions)
43
-    {
44
-        $this->packageVersions = $packageVersions;
45
-    }
36
+	/**
37
+	 * Class constructor.
38
+	 *
39
+	 * @param array $packageVersions
40
+	 * @return void
41
+	 */
42
+	public function __construct($packageVersions)
43
+	{
44
+		$this->packageVersions = $packageVersions;
45
+	}
46 46
 }
47 47
 
48 48
 
Please login to merge, or discard this patch.
src/Davispeixoto/ForceDotComToolkitForPhp/AllowFieldTruncationHeader.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -28,12 +28,12 @@
 block discarded – undo
28 28
 
29 29
 class AllowFieldTruncationHeader
30 30
 {
31
-    public $allowFieldTruncation;
31
+	public $allowFieldTruncation;
32 32
 
33
-    public function __construct($allowFieldTruncation)
34
-    {
35
-        $this->allowFieldTruncation = $allowFieldTruncation;
36
-    }
33
+	public function __construct($allowFieldTruncation)
34
+	{
35
+		$this->allowFieldTruncation = $allowFieldTruncation;
36
+	}
37 37
 }
38 38
 
39 39
 ?>
Please login to merge, or discard this patch.
src/Davispeixoto/ForceDotComToolkitForPhp/SforceFieldTypes.php 1 patch
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -28,23 +28,23 @@
 block discarded – undo
28 28
 
29 29
 class SforceFieldTypes
30 30
 {
31
-    const DEPLOYMENT_STATUS_INDEVELOPMENT = 'InDevelopment';
32
-    const DEPLOYMENT_STATUS_DEPLOYED = 'Deployed';
31
+	const DEPLOYMENT_STATUS_INDEVELOPMENT = 'InDevelopment';
32
+	const DEPLOYMENT_STATUS_DEPLOYED = 'Deployed';
33 33
 
34
-    const GENDER_NEUTER = 'Neuter';
35
-    const GENDER_MASCULINE = 'Masculine';
36
-    const GENDER_FEMININE = 'Feminine';
34
+	const GENDER_NEUTER = 'Neuter';
35
+	const GENDER_MASCULINE = 'Masculine';
36
+	const GENDER_FEMININE = 'Feminine';
37 37
 
38
-    const SHARING_MODEL_PRIVATE = 'Private';
39
-    const SHARING_MODEL_READ = 'Read';
40
-    const SHARING_MODEL_READWRITE = 'ReadWrite';
38
+	const SHARING_MODEL_PRIVATE = 'Private';
39
+	const SHARING_MODEL_READ = 'Read';
40
+	const SHARING_MODEL_READWRITE = 'ReadWrite';
41 41
 
42
-    const STARTS_WITH_CONSONANT = 'Consonant';
43
-    const STARTS_WITH_VOWEL = 'Vowel';
44
-    const STARTS_WITH_SPECIAL = 'Special';
42
+	const STARTS_WITH_CONSONANT = 'Consonant';
43
+	const STARTS_WITH_VOWEL = 'Vowel';
44
+	const STARTS_WITH_SPECIAL = 'Special';
45 45
 
46
-    const TREAT_BLANKS_AS_BLANK = 'BlankAsBlank';
47
-    const TREAT_BLANKS_AS_ZERO = 'BlankAsZero';
46
+	const TREAT_BLANKS_AS_BLANK = 'BlankAsBlank';
47
+	const TREAT_BLANKS_AS_ZERO = 'BlankAsZero';
48 48
 }
49 49
 
50 50
 ?>
Please login to merge, or discard this patch.
src/Davispeixoto/ForceDotComToolkitForPhp/UserTerritoryDeleteHeader.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -28,12 +28,12 @@
 block discarded – undo
28 28
 
29 29
 class UserTerritoryDeleteHeader
30 30
 {
31
-    public $transferToUserId;
31
+	public $transferToUserId;
32 32
 
33
-    public function __construct($transferToUserId)
34
-    {
35
-        $this->transferToUserId = $transferToUserId;
36
-    }
33
+	public function __construct($transferToUserId)
34
+	{
35
+		$this->transferToUserId = $transferToUserId;
36
+	}
37 37
 }
38 38
 
39 39
 ?>
Please login to merge, or discard this patch.
src/Davispeixoto/ForceDotComToolkitForPhp/LocaleOptions.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -29,18 +29,18 @@
 block discarded – undo
29 29
 
30 30
 class LocaleOptions
31 31
 {
32
-    public $language;
32
+	public $language;
33 33
 
34
-    /**
35
-     * Class constructor.
36
-     *
37
-     * @param string $language
38
-     * @return void
39
-     */
40
-    public function __construct($language)
41
-    {
42
-        $this->language = $language;
43
-    }
34
+	/**
35
+	 * Class constructor.
36
+	 *
37
+	 * @param string $language
38
+	 * @return void
39
+	 */
40
+	public function __construct($language)
41
+	{
42
+		$this->language = $language;
43
+	}
44 44
 }
45 45
 
46 46
 ?>
Please login to merge, or discard this patch.