Completed
Pull Request — master (#4)
by
unknown
02:20
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.
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.
Indentation   +974 added lines, -974 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,1003 +42,1003 @@  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();
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
+	}
192 71
 
193
-        return $this->sforce->logout();
194
-    }
72
+	public function getNamespace()
73
+	{
74
+		return $this->namespace;
75
+	}
195 76
 
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
-    {
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 638
 		$this->setHeaders("convertLead");
639
-        $arg = new stdClass();
639
+		$arg = new stdClass();
640 640
         
641
-        foreach ($leadConverts as $k => $lc) {
642
-            if (isset($lc->contactRecord) && !$lc->contactRecord instanceof SoapVar) {
643
-                $lc->contactRecord = new SoapVar($lc->contactRecord, SOAP_ENC_OBJECT, 'Contact', $this->namespace);
644
-            }
641
+		foreach ($leadConverts as $k => $lc) {
642
+			if (isset($lc->contactRecord) && !$lc->contactRecord instanceof SoapVar) {
643
+				$lc->contactRecord = new SoapVar($lc->contactRecord, SOAP_ENC_OBJECT, 'Contact', $this->namespace);
644
+			}
645 645
 
646
-            if (isset($lc->opportunityRecord) && !$lc->opportunityRecord instanceof SoapVar) {
647
-                $lc->opportunityRecord = new SoapVar($lc->opportunityRecord, SOAP_ENC_OBJECT, 'Opportunity', $this->namespace);
648
-            }
646
+			if (isset($lc->opportunityRecord) && !$lc->opportunityRecord instanceof SoapVar) {
647
+				$lc->opportunityRecord = new SoapVar($lc->opportunityRecord, SOAP_ENC_OBJECT, 'Opportunity', $this->namespace);
648
+			}
649 649
 
650
-            if (isset($lc->accountRecord) && !$lc->accountRecord instanceof SoapVar) {
651
-                $lc->accountRecord = new SoapVar($lc->accountRecord, SOAP_ENC_OBJECT, 'Account', $this->namespace);
652
-            }
650
+			if (isset($lc->accountRecord) && !$lc->accountRecord instanceof SoapVar) {
651
+				$lc->accountRecord = new SoapVar($lc->accountRecord, SOAP_ENC_OBJECT, 'Account', $this->namespace);
652
+			}
653 653
 
654
-            $leadConverts[$k] = $lc;
655
-        }
654
+			$leadConverts[$k] = $lc;
655
+		}
656 656
 		
657
-        $arg->leadConverts = $leadConverts;
657
+		$arg->leadConverts = $leadConverts;
658 658
         
659 659
 		return $this->sforce->convertLead($arg);
660 660
 	}
661 661
 
662
-    /**
663
-     * Deletes one or more new individual objects to your organization's data.
664
-     *
665
-     * @param array $ids Array of fields
666
-     * @return DeleteResult
667
-     */
668
-    public function delete($ids)
669
-    {
670
-        $this->setHeaders("delete");
671
-        $arg = new stdClass();
672
-        $arg->ids = $ids;
662
+	/**
663
+	 * Deletes one or more new individual objects to your organization's data.
664
+	 *
665
+	 * @param array $ids Array of fields
666
+	 * @return DeleteResult
667
+	 */
668
+	public function delete($ids)
669
+	{
670
+		$this->setHeaders("delete");
671
+		$arg = new stdClass();
672
+		$arg->ids = $ids;
673
+
674
+		return $this->sforce->delete($arg)->result;
675
+	}
673 676
 
674
-        return $this->sforce->delete($arg)->result;
675
-    }
677
+	/**
678
+	 * Deletes one or more new individual objects to your organization's data.
679
+	 *
680
+	 * @param array $ids Array of fields
681
+	 * @return DeleteResult
682
+	 */
683
+	public function undelete($ids)
684
+	{
685
+		$this->setHeaders("undelete");
686
+		$arg = new stdClass();
687
+		$arg->ids = $ids;
688
+
689
+		return $this->sforce->undelete($arg)->result;
690
+	}
676 691
 
677
-    /**
678
-     * Deletes one or more new individual objects to your organization's data.
679
-     *
680
-     * @param array $ids Array of fields
681
-     * @return DeleteResult
682
-     */
683
-    public function undelete($ids)
684
-    {
685
-        $this->setHeaders("undelete");
686
-        $arg = new stdClass();
687
-        $arg->ids = $ids;
692
+	/**
693
+	 * Deletes one or more new individual objects to your organization's data.
694
+	 *
695
+	 * @param array $ids Array of fields
696
+	 * @return DeleteResult
697
+	 */
698
+	public function emptyRecycleBin($ids)
699
+	{
700
+		$this->setHeaders();
701
+		$arg = new stdClass();
702
+		$arg->ids = $ids;
703
+
704
+		return $this->sforce->emptyRecycleBin($arg)->result;
705
+	}
688 706
 
689
-        return $this->sforce->undelete($arg)->result;
690
-    }
707
+	/**
708
+	 * Process Submit Request for Approval
709
+	 *
710
+	 * @param array $processRequestArray
711
+	 * @return ProcessResult
712
+	 */
713
+	public function processSubmitRequest($processRequestArray)
714
+	{
715
+		if (is_array($processRequestArray)) {
716
+			foreach ($processRequestArray as &$process) {
717
+				$process = new SoapVar($process, SOAP_ENC_OBJECT, 'ProcessSubmitRequest', $this->namespace);
718
+			}
719
+			$arg = new stdClass();
720
+			$arg->actions = $processRequestArray;
721
+
722
+			return $this->_process($arg);
723
+		} else {
724
+			$backtrace = debug_backtrace();
725
+			error_log('Please pass in array to this function:  ' . $backtrace[0]['function']);
726
+			return false;
727
+		}
728
+	}
691 729
 
692
-    /**
693
-     * Deletes one or more new individual objects to your organization's data.
694
-     *
695
-     * @param array $ids Array of fields
696
-     * @return DeleteResult
697
-     */
698
-    public function emptyRecycleBin($ids)
699
-    {
700
-        $this->setHeaders();
701
-        $arg = new stdClass();
702
-        $arg->ids = $ids;
730
+	/**
731
+	 * Process Work Item Request for Approval
732
+	 *
733
+	 * @param array $processRequestArray
734
+	 * @return ProcessResult
735
+	 */
736
+	public function processWorkitemRequest($processRequestArray)
737
+	{
738
+		if (is_array($processRequestArray)) {
739
+			foreach ($processRequestArray as &$process) {
740
+				$process = new SoapVar($process, SOAP_ENC_OBJECT, 'ProcessWorkitemRequest', $this->namespace);
741
+			}
742
+			$arg = new stdClass();
743
+			$arg->actions = $processRequestArray;
744
+
745
+			return $this->_process($arg);
746
+		} else {
747
+			$backtrace = debug_backtrace();
748
+			error_log('Please pass in array to this function:  ' . $backtrace[0]['function']);
749
+			return false;
750
+		}
751
+	}
703 752
 
704
-        return $this->sforce->emptyRecycleBin($arg)->result;
705
-    }
753
+	/**
754
+	 * Retrieves a list of available objects for your organization's data.
755
+	 *
756
+	 * @return DescribeGlobalResult
757
+	 */
758
+	public function describeGlobal()
759
+	{
760
+		$this->setHeaders("describeGlobal");
706 761
 
707
-    /**
708
-     * Process Submit Request for Approval
709
-     *
710
-     * @param array $processRequestArray
711
-     * @return ProcessResult
712
-     */
713
-    public function processSubmitRequest($processRequestArray)
714
-    {
715
-        if (is_array($processRequestArray)) {
716
-            foreach ($processRequestArray as &$process) {
717
-                $process = new SoapVar($process, SOAP_ENC_OBJECT, 'ProcessSubmitRequest', $this->namespace);
718
-            }
719
-            $arg = new stdClass();
720
-            $arg->actions = $processRequestArray;
721
-
722
-            return $this->_process($arg);
723
-        } else {
724
-            $backtrace = debug_backtrace();
725
-            error_log('Please pass in array to this function:  ' . $backtrace[0]['function']);
726
-            return false;
727
-        }
728
-    }
729
-
730
-    /**
731
-     * Process Work Item Request for Approval
732
-     *
733
-     * @param array $processRequestArray
734
-     * @return ProcessResult
735
-     */
736
-    public function processWorkitemRequest($processRequestArray)
737
-    {
738
-        if (is_array($processRequestArray)) {
739
-            foreach ($processRequestArray as &$process) {
740
-                $process = new SoapVar($process, SOAP_ENC_OBJECT, 'ProcessWorkitemRequest', $this->namespace);
741
-            }
742
-            $arg = new stdClass();
743
-            $arg->actions = $processRequestArray;
744
-
745
-            return $this->_process($arg);
746
-        } else {
747
-            $backtrace = debug_backtrace();
748
-            error_log('Please pass in array to this function:  ' . $backtrace[0]['function']);
749
-            return false;
750
-        }
751
-    }
752
-
753
-    /**
754
-     * Retrieves a list of available objects for your organization's data.
755
-     *
756
-     * @return DescribeGlobalResult
757
-     */
758
-    public function describeGlobal()
759
-    {
760
-        $this->setHeaders("describeGlobal");
761
-
762
-        return $this->sforce->describeGlobal()->result;
763
-    }
764
-
765
-    /**
766
-     * Use describeLayout to retrieve information about the layout (presentation
767
-     * of data to users) for a given object type. The describeLayout call returns
768
-     * metadata about a given page layout, including layouts for edit and
769
-     * display-only views and record type mappings. Note that field-level security
770
-     * and layout editability affects which fields appear in a layout.
771
-     *
772
-     * @param string Type   Object Type
773
-     * @return DescribeLayoutResult
774
-     */
775
-    public function describeLayout($type, array $recordTypeIds = null)
776
-    {
777
-        $this->setHeaders("describeLayout");
778
-        $arg = new stdClass();
779
-        $arg->sObjectType = new SoapVar($type, XSD_STRING, 'string', 'http://www.w3.org/2001/XMLSchema');
780
-        if (isset($recordTypeIds) && count($recordTypeIds)) {
781
-            $arg->recordTypeIds = $recordTypeIds;
782
-        }
783
-
784
-        return $this->sforce->describeLayout($arg)->result;
785
-    }
786
-
787
-    /**
788
-     * Describes metadata (field list and object properties) for the specified
789
-     * object.
790
-     *
791
-     * @param string $type Object type
792
-     * @return DescribsSObjectResult
793
-     */
794
-    public function describeSObject($type)
795
-    {
796
-        $this->setHeaders("describeSObject");
797
-        $arg = new stdClass();
798
-        $arg->sObjectType = new SoapVar($type, XSD_STRING, 'string', 'http://www.w3.org/2001/XMLSchema');
799
-
800
-        return $this->sforce->describeSObject($arg)->result;
801
-    }
802
-
803
-    /**
804
-     * An array-based version of describeSObject; describes metadata (field list
805
-     * and object properties) for the specified object or array of objects.
806
-     *
807
-     * @param array $arrayOfTypes Array of object types.
808
-     * @return DescribsSObjectResult
809
-     */
810
-    public function describeSObjects($arrayOfTypes)
811
-    {
812
-        $this->setHeaders("describeSObjects");
762
+		return $this->sforce->describeGlobal()->result;
763
+	}
813 764
 
814
-        return $this->sforce->describeSObjects($arrayOfTypes)->result;
815
-    }
765
+	/**
766
+	 * Use describeLayout to retrieve information about the layout (presentation
767
+	 * of data to users) for a given object type. The describeLayout call returns
768
+	 * metadata about a given page layout, including layouts for edit and
769
+	 * display-only views and record type mappings. Note that field-level security
770
+	 * and layout editability affects which fields appear in a layout.
771
+	 *
772
+	 * @param string Type   Object Type
773
+	 * @return DescribeLayoutResult
774
+	 */
775
+	public function describeLayout($type, array $recordTypeIds = null)
776
+	{
777
+		$this->setHeaders("describeLayout");
778
+		$arg = new stdClass();
779
+		$arg->sObjectType = new SoapVar($type, XSD_STRING, 'string', 'http://www.w3.org/2001/XMLSchema');
780
+		if (isset($recordTypeIds) && count($recordTypeIds)) {
781
+			$arg->recordTypeIds = $recordTypeIds;
782
+		}
783
+
784
+		return $this->sforce->describeLayout($arg)->result;
785
+	}
816 786
 
817
-    /**
818
-     * The describeTabs call returns information about the standard apps and
819
-     * custom apps, if any, available for the user who sends the call, including
820
-     * the list of tabs defined for each app.
821
-     *
822
-     * @return DescribeTabSetResult
823
-     */
824
-    public function describeTabs()
825
-    {
826
-        $this->setHeaders("describeTabs");
787
+	/**
788
+	 * Describes metadata (field list and object properties) for the specified
789
+	 * object.
790
+	 *
791
+	 * @param string $type Object type
792
+	 * @return DescribsSObjectResult
793
+	 */
794
+	public function describeSObject($type)
795
+	{
796
+		$this->setHeaders("describeSObject");
797
+		$arg = new stdClass();
798
+		$arg->sObjectType = new SoapVar($type, XSD_STRING, 'string', 'http://www.w3.org/2001/XMLSchema');
799
+
800
+		return $this->sforce->describeSObject($arg)->result;
801
+	}
827 802
 
828
-        return $this->sforce->describeTabs()->result;
829
-    }
803
+	/**
804
+	 * An array-based version of describeSObject; describes metadata (field list
805
+	 * and object properties) for the specified object or array of objects.
806
+	 *
807
+	 * @param array $arrayOfTypes Array of object types.
808
+	 * @return DescribsSObjectResult
809
+	 */
810
+	public function describeSObjects($arrayOfTypes)
811
+	{
812
+		$this->setHeaders("describeSObjects");
813
+
814
+		return $this->sforce->describeSObjects($arrayOfTypes)->result;
815
+	}
830 816
 
831
-    /**
832
-     * To enable data categories groups you must enable Answers or Knowledge Articles module in
833
-     * admin panel, after adding category group and assign it to Answers or Knowledge Articles
834
-     *
835
-     * @param string $sObjectType sObject Type
836
-     * @return DescribeDataCategoryGroupResult
837
-     */
838
-    public function describeDataCategoryGroups($sObjectType)
839
-    {
840
-        $this->setHeaders('describeDataCategoryGroups');
841
-        $arg = new stdClass();
842
-        $arg->sObjectType = new SoapVar($sObjectType, XSD_STRING, 'string', 'http://www.w3.org/2001/XMLSchema');
817
+	/**
818
+	 * The describeTabs call returns information about the standard apps and
819
+	 * custom apps, if any, available for the user who sends the call, including
820
+	 * the list of tabs defined for each app.
821
+	 *
822
+	 * @return DescribeTabSetResult
823
+	 */
824
+	public function describeTabs()
825
+	{
826
+		$this->setHeaders("describeTabs");
827
+
828
+		return $this->sforce->describeTabs()->result;
829
+	}
843 830
 
844
-        return $this->sforce->describeDataCategoryGroups($arg)->result;
845
-    }
831
+	/**
832
+	 * To enable data categories groups you must enable Answers or Knowledge Articles module in
833
+	 * admin panel, after adding category group and assign it to Answers or Knowledge Articles
834
+	 *
835
+	 * @param string $sObjectType sObject Type
836
+	 * @return DescribeDataCategoryGroupResult
837
+	 */
838
+	public function describeDataCategoryGroups($sObjectType)
839
+	{
840
+		$this->setHeaders('describeDataCategoryGroups');
841
+		$arg = new stdClass();
842
+		$arg->sObjectType = new SoapVar($sObjectType, XSD_STRING, 'string', 'http://www.w3.org/2001/XMLSchema');
843
+
844
+		return $this->sforce->describeDataCategoryGroups($arg)->result;
845
+	}
846 846
 
847
-    /**
848
-     * Retrieves available category groups along with their data category structure for objects specified in the request.
849
-     *
850
-     * @param DataCategoryGroupSobjectTypePair $pairs
851
-     * @param bool $topCategoriesOnly Object Type
852
-     * @return DescribeLayoutResult
853
-     */
854
-    public function describeDataCategoryGroupStructures(array $pairs, $topCategoriesOnly)
855
-    {
856
-        $this->setHeaders('describeDataCategoryGroupStructures');
857
-        $arg = new stdClass();
858
-        $arg->pairs = $pairs;
859
-        $arg->topCategoriesOnly = new SoapVar($topCategoriesOnly, XSD_BOOLEAN, 'boolean',
860
-            'http://www.w3.org/2001/XMLSchema');
861
-
862
-        return $this->sforce->describeDataCategoryGroupStructures($arg)->result;
863
-    }
864
-
865
-    /**
866
-     * Retrieves the list of individual objects that have been deleted within the
867
-     * given timespan for the specified object.
868
-     *
869
-     * @param string $type Ojbect type
870
-     * @param string $startDate Start date
871
-     * @param string $endDate End Date
872
-     * @return GetDeletedResult
873
-     */
874
-    public function getDeleted($type, $startDate, $endDate)
875
-    {
876
-        $this->setHeaders("getDeleted");
877
-        $arg = new stdClass();
878
-        $arg->sObjectType = new SoapVar($type, XSD_STRING, 'string', 'http://www.w3.org/2001/XMLSchema');
879
-        $arg->startDate = $startDate;
880
-        $arg->endDate = $endDate;
881
-
882
-        return $this->sforce->getDeleted($arg)->result;
883
-    }
884
-
885
-    /**
886
-     * Retrieves the list of individual objects that have been updated (added or
887
-     * changed) within the given timespan for the specified object.
888
-     *
889
-     * @param string $type Ojbect type
890
-     * @param string $startDate Start date
891
-     * @param string $endDate End Date
892
-     * @return GetUpdatedResult
893
-     */
894
-    public function getUpdated($type, $startDate, $endDate)
895
-    {
896
-        $this->setHeaders("getUpdated");
897
-        $arg = new stdClass();
898
-        $arg->sObjectType = new SoapVar($type, XSD_STRING, 'string', 'http://www.w3.org/2001/XMLSchema');
899
-        $arg->startDate = $startDate;
900
-        $arg->endDate = $endDate;
901
-
902
-        return $this->sforce->getUpdated($arg)->result;
903
-    }
904
-
905
-    /**
906
-     * Executes a query against the specified object and returns data that matches
907
-     * the specified criteria.
908
-     *
909
-     * @param string $query Query String
910
-     * @param QueryOptions $queryOptions Batch size limit.  OPTIONAL
911
-     * @return QueryResult
912
-     */
913
-    public function query($query)
914
-    {
915
-        $this->setHeaders("query");
916
-        $raw = $this->sforce->query(array(
917
-            'queryString' => $query
918
-        ))->result;
919
-        $QueryResult = new QueryResult($raw);
920
-        $QueryResult->setSf($this); // Dependency Injection
921
-        return $QueryResult;
922
-    }
923
-
924
-    /**
925
-     * Retrieves the next batch of objects from a query.
926
-     *
927
-     * @param string $queryLocator Represents the server-side cursor that tracks the current processing location in the query result set.
928
-     * @param QueryOptions $queryOptions Batch size limit.  OPTIONAL
929
-     * @return QueryResult
930
-     */
931
-    public function queryMore($queryLocator)
932
-    {
933
-        $this->setHeaders("queryMore");
934
-        $arg = new stdClass();
935
-        $arg->queryLocator = $queryLocator;
936
-        $raw = $this->sforce->queryMore($arg)->result;
937
-        $QueryResult = new QueryResult($raw);
938
-        $QueryResult->setSf($this); // Dependency Injection
939
-        return $QueryResult;
940
-    }
941
-
942
-    /**
943
-     * Retrieves data from specified objects, whether or not they have been deleted.
944
-     *
945
-     * @param String $query Query String
946
-     * @param QueryOptions $queryOptions Batch size limit.  OPTIONAL
947
-     * @return QueryResult
948
-     */
949
-    public function queryAll($query, $queryOptions = null)
950
-    {
951
-        $this->setHeaders("queryAll");
952
-        $raw = $this->sforce->queryAll(array(
953
-            'queryString' => $query
954
-        ))->result;
955
-        $QueryResult = new QueryResult($raw);
956
-        $QueryResult->setSf($this); // Dependency Injection
957
-        return $QueryResult;
958
-    }
959
-
960
-
961
-    /**
962
-     * Retrieves one or more objects based on the specified object IDs.
963
-     *
964
-     * @param string $fieldList One or more fields separated by commas.
965
-     * @param string $sObjectType Object from which to retrieve data.
966
-     * @param array $ids Array of one or more IDs of the objects to retrieve.
967
-     * @return sObject[]
968
-     */
969
-    public function retrieve($fieldList, $sObjectType, $ids)
970
-    {
971
-        $this->setHeaders("retrieve");
972
-        $arg = new stdClass();
973
-        $arg->fieldList = $fieldList;
974
-        $arg->sObjectType = new SoapVar($sObjectType, XSD_STRING, 'string', 'http://www.w3.org/2001/XMLSchema');
975
-        $arg->ids = $ids;
976
-
977
-        return $this->sforce->retrieve($arg)->result;
978
-    }
979
-
980
-    /**
981
-     * Executes a text search in your organization's data.
982
-     *
983
-     * @param string $searchString Search string that specifies the text expression to search for.
984
-     * @return SearchResult
985
-     */
986
-    public function search($searchString)
987
-    {
988
-        $this->setHeaders("search");
989
-        $arg = new stdClass();
990
-        $arg->searchString = new SoapVar($searchString, XSD_STRING, 'string', 'http://www.w3.org/2001/XMLSchema');
847
+	/**
848
+	 * Retrieves available category groups along with their data category structure for objects specified in the request.
849
+	 *
850
+	 * @param DataCategoryGroupSobjectTypePair $pairs
851
+	 * @param bool $topCategoriesOnly Object Type
852
+	 * @return DescribeLayoutResult
853
+	 */
854
+	public function describeDataCategoryGroupStructures(array $pairs, $topCategoriesOnly)
855
+	{
856
+		$this->setHeaders('describeDataCategoryGroupStructures');
857
+		$arg = new stdClass();
858
+		$arg->pairs = $pairs;
859
+		$arg->topCategoriesOnly = new SoapVar($topCategoriesOnly, XSD_BOOLEAN, 'boolean',
860
+			'http://www.w3.org/2001/XMLSchema');
861
+
862
+		return $this->sforce->describeDataCategoryGroupStructures($arg)->result;
863
+	}
991 864
 
992
-        return new SforceSearchResult($this->sforce->search($arg)->result);
993
-    }
865
+	/**
866
+	 * Retrieves the list of individual objects that have been deleted within the
867
+	 * given timespan for the specified object.
868
+	 *
869
+	 * @param string $type Ojbect type
870
+	 * @param string $startDate Start date
871
+	 * @param string $endDate End Date
872
+	 * @return GetDeletedResult
873
+	 */
874
+	public function getDeleted($type, $startDate, $endDate)
875
+	{
876
+		$this->setHeaders("getDeleted");
877
+		$arg = new stdClass();
878
+		$arg->sObjectType = new SoapVar($type, XSD_STRING, 'string', 'http://www.w3.org/2001/XMLSchema');
879
+		$arg->startDate = $startDate;
880
+		$arg->endDate = $endDate;
881
+
882
+		return $this->sforce->getDeleted($arg)->result;
883
+	}
994 884
 
995
-    /**
996
-     * Retrieves the current system timestamp (GMT) from the Web service.
997
-     *
998
-     * @return timestamp
999
-     */
1000
-    public function getServerTimestamp()
1001
-    {
1002
-        $this->setHeaders("getServerTimestamp");
885
+	/**
886
+	 * Retrieves the list of individual objects that have been updated (added or
887
+	 * changed) within the given timespan for the specified object.
888
+	 *
889
+	 * @param string $type Ojbect type
890
+	 * @param string $startDate Start date
891
+	 * @param string $endDate End Date
892
+	 * @return GetUpdatedResult
893
+	 */
894
+	public function getUpdated($type, $startDate, $endDate)
895
+	{
896
+		$this->setHeaders("getUpdated");
897
+		$arg = new stdClass();
898
+		$arg->sObjectType = new SoapVar($type, XSD_STRING, 'string', 'http://www.w3.org/2001/XMLSchema');
899
+		$arg->startDate = $startDate;
900
+		$arg->endDate = $endDate;
901
+
902
+		return $this->sforce->getUpdated($arg)->result;
903
+	}
1003 904
 
1004
-        return $this->sforce->getServerTimestamp()->result;
1005
-    }
905
+	/**
906
+	 * Executes a query against the specified object and returns data that matches
907
+	 * the specified criteria.
908
+	 *
909
+	 * @param string $query Query String
910
+	 * @param QueryOptions $queryOptions Batch size limit.  OPTIONAL
911
+	 * @return QueryResult
912
+	 */
913
+	public function query($query)
914
+	{
915
+		$this->setHeaders("query");
916
+		$raw = $this->sforce->query(array(
917
+			'queryString' => $query
918
+		))->result;
919
+		$QueryResult = new QueryResult($raw);
920
+		$QueryResult->setSf($this); // Dependency Injection
921
+		return $QueryResult;
922
+	}
1006 923
 
1007
-    public function getUserInfo()
1008
-    {
1009
-        $this->setHeaders("getUserInfo");
924
+	/**
925
+	 * Retrieves the next batch of objects from a query.
926
+	 *
927
+	 * @param string $queryLocator Represents the server-side cursor that tracks the current processing location in the query result set.
928
+	 * @param QueryOptions $queryOptions Batch size limit.  OPTIONAL
929
+	 * @return QueryResult
930
+	 */
931
+	public function queryMore($queryLocator)
932
+	{
933
+		$this->setHeaders("queryMore");
934
+		$arg = new stdClass();
935
+		$arg->queryLocator = $queryLocator;
936
+		$raw = $this->sforce->queryMore($arg)->result;
937
+		$QueryResult = new QueryResult($raw);
938
+		$QueryResult->setSf($this); // Dependency Injection
939
+		return $QueryResult;
940
+	}
1010 941
 
1011
-        return $this->sforce->getUserInfo()->result;
1012
-    }
942
+	/**
943
+	 * Retrieves data from specified objects, whether or not they have been deleted.
944
+	 *
945
+	 * @param String $query Query String
946
+	 * @param QueryOptions $queryOptions Batch size limit.  OPTIONAL
947
+	 * @return QueryResult
948
+	 */
949
+	public function queryAll($query, $queryOptions = null)
950
+	{
951
+		$this->setHeaders("queryAll");
952
+		$raw = $this->sforce->queryAll(array(
953
+			'queryString' => $query
954
+		))->result;
955
+		$QueryResult = new QueryResult($raw);
956
+		$QueryResult->setSf($this); // Dependency Injection
957
+		return $QueryResult;
958
+	}
1013 959
 
1014
-    /**
1015
-     * Sets the specified user's password to the specified value.
1016
-     *
1017
-     * @param string $userId ID of the User.
1018
-     * @param string $password New password
1019
-     */
1020
-    public function setPassword($userId, $password)
1021
-    {
1022
-        $this->setHeaders("setPassword");
1023
-        $arg = new stdClass();
1024
-        $arg->userId = new SoapVar($userId, XSD_STRING, 'string', 'http://www.w3.org/2001/XMLSchema');
1025
-        $arg->password = $password;
1026
-
1027
-        return $this->sforce->setPassword($arg);
1028
-    }
1029
-
1030
-    /**
1031
-     * Changes a user's password to a system-generated value.
1032
-     *
1033
-     * @param string $userId Id of the User
1034
-     * @return password
1035
-     */
1036
-    public function resetPassword($userId)
1037
-    {
1038
-        $this->setHeaders("resetPassword");
1039
-        $arg = new stdClass();
1040
-        $arg->userId = new SoapVar($userId, XSD_STRING, 'string', 'http://www.w3.org/2001/XMLSchema');
1041
-
1042
-        return $this->sforce->resetPassword($arg)->result;
1043
-    }
960
+
961
+	/**
962
+	 * Retrieves one or more objects based on the specified object IDs.
963
+	 *
964
+	 * @param string $fieldList One or more fields separated by commas.
965
+	 * @param string $sObjectType Object from which to retrieve data.
966
+	 * @param array $ids Array of one or more IDs of the objects to retrieve.
967
+	 * @return sObject[]
968
+	 */
969
+	public function retrieve($fieldList, $sObjectType, $ids)
970
+	{
971
+		$this->setHeaders("retrieve");
972
+		$arg = new stdClass();
973
+		$arg->fieldList = $fieldList;
974
+		$arg->sObjectType = new SoapVar($sObjectType, XSD_STRING, 'string', 'http://www.w3.org/2001/XMLSchema');
975
+		$arg->ids = $ids;
976
+
977
+		return $this->sforce->retrieve($arg)->result;
978
+	}
979
+
980
+	/**
981
+	 * Executes a text search in your organization's data.
982
+	 *
983
+	 * @param string $searchString Search string that specifies the text expression to search for.
984
+	 * @return SearchResult
985
+	 */
986
+	public function search($searchString)
987
+	{
988
+		$this->setHeaders("search");
989
+		$arg = new stdClass();
990
+		$arg->searchString = new SoapVar($searchString, XSD_STRING, 'string', 'http://www.w3.org/2001/XMLSchema');
991
+
992
+		return new SforceSearchResult($this->sforce->search($arg)->result);
993
+	}
994
+
995
+	/**
996
+	 * Retrieves the current system timestamp (GMT) from the Web service.
997
+	 *
998
+	 * @return timestamp
999
+	 */
1000
+	public function getServerTimestamp()
1001
+	{
1002
+		$this->setHeaders("getServerTimestamp");
1003
+
1004
+		return $this->sforce->getServerTimestamp()->result;
1005
+	}
1006
+
1007
+	public function getUserInfo()
1008
+	{
1009
+		$this->setHeaders("getUserInfo");
1010
+
1011
+		return $this->sforce->getUserInfo()->result;
1012
+	}
1013
+
1014
+	/**
1015
+	 * Sets the specified user's password to the specified value.
1016
+	 *
1017
+	 * @param string $userId ID of the User.
1018
+	 * @param string $password New password
1019
+	 */
1020
+	public function setPassword($userId, $password)
1021
+	{
1022
+		$this->setHeaders("setPassword");
1023
+		$arg = new stdClass();
1024
+		$arg->userId = new SoapVar($userId, XSD_STRING, 'string', 'http://www.w3.org/2001/XMLSchema');
1025
+		$arg->password = $password;
1026
+
1027
+		return $this->sforce->setPassword($arg);
1028
+	}
1029
+
1030
+	/**
1031
+	 * Changes a user's password to a system-generated value.
1032
+	 *
1033
+	 * @param string $userId Id of the User
1034
+	 * @return password
1035
+	 */
1036
+	public function resetPassword($userId)
1037
+	{
1038
+		$this->setHeaders("resetPassword");
1039
+		$arg = new stdClass();
1040
+		$arg->userId = new SoapVar($userId, XSD_STRING, 'string', 'http://www.w3.org/2001/XMLSchema');
1041
+
1042
+		return $this->sforce->resetPassword($arg)->result;
1043
+	}
1044 1044
 }
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.