Test Failed
Push — 135-map-multiple-wordpress-obj... ( 3634c2...bb35fb )
by Jonathan
12:00
created

SObject::isSObject()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
/*
3
 * Copyright (c) 2007, salesforce.com, inc.
4
 * All rights reserved.
5
 *
6
 * Redistribution and use in source and binary forms, with or without modification, are permitted provided
7
 * that the following conditions are met:
8
 *
9
 *    Redistributions of source code must retain the above copyright notice, this list of conditions and the
10
 *    following disclaimer.
11
 *
12
 *    Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
13
 *    the following disclaimer in the documentation and/or other materials provided with the distribution.
14
 *
15
 *    Neither the name of salesforce.com, inc. nor the names of its contributors may be used to endorse or
16
 *    promote products derived from this software without specific prior written permission.
17
 *
18
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
19
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
20
 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
21
 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
22
 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
24
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25
 * POSSIBILITY OF SUCH DAMAGE.
26
 */
27
require_once ('SforceEmail.php');
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
28
require_once ('SforceProcessRequest.php');
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
29
require_once ('ProxySettings.php');
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
30
require_once ('SforceHeaderOptions.php');
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
31
32
/**
33
 * This file contains one class.
34
 * @package SalesforceSoapClient
35
 */
36
/**
37
 * SalesforceSoapClient
38
 * @package SalesforceSoapClient
39
 */
40
class SforceBaseClient {
41
	protected $sforce;
42
	protected $sessionId;
43
	protected $location;
44
	protected $version = '27.0';
45
46
	protected $namespace;
47
48
	// Header Options
49
	protected $callOptions;
50
	protected $assignmentRuleHeader;
51
	protected $emailHeader;
52
	protected $loginScopeHeader;
53
	protected $mruHeader;
54
	protected $queryHeader;
55
	protected $userTerritoryDeleteHeader;
56
	protected $sessionHeader;
57
	
58
	// new headers
59
	protected $allowFieldTruncationHeader;
60
	protected $localeOptions;
61
	protected $packageVersionHeader;
62
	
63
  protected function getSoapClient($wsdl, $options) {
0 ignored issues
show
Coding Style introduced by
The function name getSoapClient is in camel caps, but expected get_soap_client instead as per the coding standard.
Loading history...
64
		return new SoapClient($wsdl, $options);      
65
  }
66
	
67
	public function getNamespace() {
0 ignored issues
show
Coding Style introduced by
The function name getNamespace is in camel caps, but expected get_namespace instead as per the coding standard.
Loading history...
68
		return $this->namespace;
69
	}
70
71
72
	// clientId specifies which application or toolkit is accessing the
73
	// salesforce.com API. For applications that are certified salesforce.com
74
	// solutions, replace this with the value provided by salesforce.com.
75
	// Otherwise, leave this value as 'phpClient/1.0'.
76
	protected $client_id;
77
78
	public function printDebugInfo() {
0 ignored issues
show
Coding Style introduced by
The function name printDebugInfo is in camel caps, but expected print_debug_info instead as per the coding standard.
Loading history...
79
		echo "PHP Toolkit Version: $this->version\r\n";
0 ignored issues
show
introduced by
Expected next thing to be a escaping function, not '"PHP Toolkit Version: $this->version\r\n"'
Loading history...
80
		echo 'Current PHP version: ' . phpversion();
0 ignored issues
show
introduced by
Expected a sanitizing function (see Codex for 'Data Validation'), but instead saw 'phpversion'
Loading history...
81
		echo "\r\n";
82
		echo 'SOAP enabled: ';
83
		if (extension_loaded('soap')) {
0 ignored issues
show
introduced by
No space after opening parenthesis is prohibited
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
84
			echo 'True';
85
		} else {
86
			echo 'False';
87
		}
88
		echo "\r\n";
89
		echo 'OpenSSL enabled: ';
90
		if (extension_loaded('openssl')) {
0 ignored issues
show
introduced by
No space after opening parenthesis is prohibited
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
91
			echo 'True';
92
		} else {
93
			echo 'False';
94
		}
95
	}
96
	
97
	/**
98
	 * Connect method to www.salesforce.com
99
	 *
100
	 * @param string $wsdl   Salesforce.com Partner WSDL
101
   * @param object $proxy  (optional) proxy settings with properties host, port,
102
   *                       login and password
103
   * @param array $soap_options (optional) Additional options to send to the
104
   *                       SoapClient constructor. @see
105
   *                       http://php.net/manual/en/soapclient.soapclient.php
106
	 */
107
	public function createConnection($wsdl, $proxy=null, $soap_options=array()) {
0 ignored issues
show
Coding Style introduced by
The function name createConnection is in camel caps, but expected create_connection instead as per the coding standard.
Loading history...
introduced by
Expected 1 space between argument "$proxy" and equals sign; 0 found
Loading history...
introduced by
Expected 1 space between default value and equals sign for argument "$proxy";
Loading history...
introduced by
Expected 1 space between argument "$soap_options" and equals sign; 0 found
Loading history...
introduced by
Expected 1 space between default value and equals sign for argument "$soap_options";
Loading history...
108
		$phpversion = substr(phpversion(), 0, strpos(phpversion(), '-'));
0 ignored issues
show
Unused Code introduced by
$phpversion is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
109
		
110
		$soapClientArray = array_merge(array (
0 ignored issues
show
introduced by
There must be no space between the Array keyword and the opening parenthesis
Loading history...
111
			'user_agent' => 'salesforce-toolkit-php/'.$this->version,
112
			'encoding' => 'utf-8',
113
			'trace' => 1,
114
			'features' => SOAP_SINGLE_ELEMENT_ARRAYS,
115
			'compression' => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP
0 ignored issues
show
introduced by
Each line in an array declaration must end in a comma
Loading history...
116
		), $soap_options);
117
118
		// We don't need to parse out any subversion suffix - e.g. "-01" since
119
		// PHP type conversion will ignore it
120
		if (phpversion() < 5.2) {
0 ignored issues
show
introduced by
No space after opening parenthesis is prohibited
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
121
			die("PHP versions older than 5.2 are no longer supported. Please upgrade!");
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal PHP versions older than ...ported. Please upgrade! does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
122
		}
123
124
		if ($proxy != null) {
0 ignored issues
show
introduced by
No space after opening parenthesis is prohibited
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
125
            $proxySettings = array();
126
            $proxySettings['proxy_host'] = $proxy->host;
127
            $proxySettings['proxy_port'] = $proxy->port; // Use an integer, not a string
128
            $proxySettings['proxy_login'] = $proxy->login; 
129
            $proxySettings['proxy_password'] = $proxy->password;
130
            $soapClientArray = array_merge($soapClientArray, $proxySettings);
131
		}
132
133
  	$this->sforce = $this->getSoapClient($wsdl, $soapClientArray);
134
135
		return $this->sforce;
136
	}
137
138
	public function setCallOptions($header) {
0 ignored issues
show
Coding Style introduced by
The function name setCallOptions is in camel caps, but expected set_call_options instead as per the coding standard.
Loading history...
139
		if ($header != NULL) {
0 ignored issues
show
introduced by
No space after opening parenthesis is prohibited
Loading history...
Coding Style introduced by
TRUE, FALSE and NULL must be lowercase; expected null, but found NULL.
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
140
			$this->callOptions = new SoapHeader($this->namespace, 'CallOptions', array (
0 ignored issues
show
introduced by
There must be no space between the Array keyword and the opening parenthesis
Loading history...
141
		  'client' => $header->client,
0 ignored issues
show
Coding Style introduced by
This line of the multi-line function call does not seem to be indented correctly. Expected 16 spaces, but found 10.
Loading history...
142
		  'defaultNamespace' => $header->defaultNamespace
0 ignored issues
show
Coding Style introduced by
This line of the multi-line function call does not seem to be indented correctly. Expected 16 spaces, but found 10.
Loading history...
introduced by
Each line in an array declaration must end in a comma
Loading history...
143
			));
144
		} else {
145
			$this->callOptions = NULL;
0 ignored issues
show
Coding Style introduced by
TRUE, FALSE and NULL must be lowercase; expected null, but found NULL.
Loading history...
146
		}
147
	}
148
149
	/**
150
	 * Login to Salesforce.com and starts a client session.
151
	 *
152
	 * @param string $username   Username
153
	 * @param string $password   Password
154
	 *
155
	 * @return LoginResult
156
	 */
157
	public function login($username, $password) {
158
		$this->sforce->__setSoapHeaders(NULL);
0 ignored issues
show
Coding Style introduced by
TRUE, FALSE and NULL must be lowercase; expected null, but found NULL.
Loading history...
159
		if ($this->callOptions != NULL) {
0 ignored issues
show
introduced by
No space after opening parenthesis is prohibited
Loading history...
Coding Style introduced by
TRUE, FALSE and NULL must be lowercase; expected null, but found NULL.
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
160
			$this->sforce->__setSoapHeaders(array($this->callOptions));
0 ignored issues
show
introduced by
No space after opening parenthesis of array is bad style
Loading history...
introduced by
No space before closing parenthesis of array is bad style
Loading history...
161
		}
162
		if ($this->loginScopeHeader != NULL) {
0 ignored issues
show
introduced by
No space after opening parenthesis is prohibited
Loading history...
Coding Style introduced by
TRUE, FALSE and NULL must be lowercase; expected null, but found NULL.
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
163
			$this->sforce->__setSoapHeaders(array($this->loginScopeHeader));
0 ignored issues
show
introduced by
No space after opening parenthesis of array is bad style
Loading history...
introduced by
No space before closing parenthesis of array is bad style
Loading history...
164
		}
165
		$result = $this->sforce->login(array (
0 ignored issues
show
introduced by
There must be no space between the Array keyword and the opening parenthesis
Loading history...
166
		 'username' => $username,
0 ignored issues
show
Coding Style introduced by
This line of the multi-line function call does not seem to be indented correctly. Expected 12 spaces, but found 9.
Loading history...
167
		 'password' => $password
0 ignored issues
show
Coding Style introduced by
This line of the multi-line function call does not seem to be indented correctly. Expected 12 spaces, but found 9.
Loading history...
introduced by
Each line in an array declaration must end in a comma
Loading history...
168
		));
169
		$result = $result->result;
170
		$this->_setLoginHeader($result);
171
		
172
		return $result;
173
	}
174
175
	/**
176
	 * log outs from the salseforce system`
177
	 *
178
	 * @return LogoutResult
179
	 */
180
	public function logout() {
181
        $this->setHeaders("logout");
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal logout does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
182
		$arg = new stdClass();
0 ignored issues
show
Unused Code introduced by
$arg is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
183
		return $this->sforce->logout();
184
	}
185
 
186
	/**
187
	 *invalidate Sessions from the salseforce system`
188
	 *
189
	 * @return invalidateSessionsResult
190
	 */
191
	public function invalidateSessions() {
0 ignored issues
show
Coding Style introduced by
The function name invalidateSessions is in camel caps, but expected invalidate_sessions instead as per the coding standard.
Loading history...
192
        $this->setHeaders("invalidateSessions");
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal invalidateSessions does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
193
		$arg = new stdClass();
0 ignored issues
show
Unused Code introduced by
$arg is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
194
        $this->logout();
195
		return $this->sforce->invalidateSessions();
196
	} 
197
 
198
	/**
199
	 * Specifies the session ID returned from the login server after a successful
200
	 * login.
201
	 */
202 View Code Duplication
	protected function _setLoginHeader($loginResult) {
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
Coding Style introduced by
The function name _setLoginHeader is in camel caps, but expected _set_login_header instead as per the coding standard.
Loading history...
203
		$this->sessionId = $loginResult->sessionId;
204
		$this->setSessionHeader($this->sessionId);
205
		$serverURL = $loginResult->serverUrl;
206
		$this->setEndPoint($serverURL);
207
	}
208
209
	/**
210
	 * Set the endpoint.
211
	 *
212
	 * @param string $location   Location
213
	 */
214
	public function setEndpoint($location) {
0 ignored issues
show
Coding Style introduced by
The function name setEndpoint is in camel caps, but expected set_endpoint instead as per the coding standard.
Loading history...
215
		$this->location = $location;
216
		$this->sforce->__setLocation($location);
217
	}
218
219
	private function setHeaders($call=NULL) {
0 ignored issues
show
Coding Style introduced by
The function name setHeaders is in camel caps, but expected set_headers instead as per the coding standard.
Loading history...
introduced by
Expected 1 space between argument "$call" and equals sign; 0 found
Loading history...
introduced by
Expected 1 space between default value and equals sign for argument "$call";
Loading history...
Coding Style introduced by
TRUE, FALSE and NULL must be lowercase; expected null, but found NULL.
Loading history...
220
		$this->sforce->__setSoapHeaders(NULL);
0 ignored issues
show
Coding Style introduced by
TRUE, FALSE and NULL must be lowercase; expected null, but found NULL.
Loading history...
221
		
222
		$header_array = array (
0 ignored issues
show
introduced by
There must be no space between the Array keyword and the opening parenthesis
Loading history...
223
			$this->sessionHeader
224
		);
225
226
		$header = $this->callOptions;
227
		if ($header != NULL) {
0 ignored issues
show
introduced by
No space after opening parenthesis is prohibited
Loading history...
Coding Style introduced by
TRUE, FALSE and NULL must be lowercase; expected null, but found NULL.
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
228
			array_push($header_array, $header);
229
		}
230
231 View Code Duplication
		if ($call == "create" ||
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
introduced by
No space after opening parenthesis is prohibited
Loading history...
introduced by
Found "== "". Use Yoda Condition checks, you must
Loading history...
Coding Style Comprehensibility introduced by
The string literal create does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
232
		$call == "merge" ||
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal merge does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
233
		$call == "update" ||
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal update does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
234
		$call == "upsert"
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal upsert does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
235
		) {
236
			$header = $this->assignmentRuleHeader;
237
			if ($header != NULL) {
0 ignored issues
show
introduced by
No space after opening parenthesis is prohibited
Loading history...
Coding Style introduced by
TRUE, FALSE and NULL must be lowercase; expected null, but found NULL.
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
238
				array_push($header_array, $header);
239
			}
240
		}
241
242
		if ($call == "login") {
0 ignored issues
show
introduced by
No space after opening parenthesis is prohibited
Loading history...
introduced by
Found "== "". Use Yoda Condition checks, you must
Loading history...
Coding Style Comprehensibility introduced by
The string literal login does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
243
			$header = $this->loginScopeHeader;
244
			if ($header != NULL) {
0 ignored issues
show
introduced by
No space after opening parenthesis is prohibited
Loading history...
Coding Style introduced by
TRUE, FALSE and NULL must be lowercase; expected null, but found NULL.
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
245
				array_push($header_array, $header);
246
			}
247
		}
248
249 View Code Duplication
		if ($call == "create" ||
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
introduced by
No space after opening parenthesis is prohibited
Loading history...
introduced by
Found "== "". Use Yoda Condition checks, you must
Loading history...
Coding Style Comprehensibility introduced by
The string literal create does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
250
		$call == "resetPassword" ||
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal resetPassword does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
251
		$call == "update" ||
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal update does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
252
		$call == "upsert"
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal upsert does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
253
		) {
254
			$header = $this->emailHeader;
255
			if ($header != NULL) {
0 ignored issues
show
introduced by
No space after opening parenthesis is prohibited
Loading history...
Coding Style introduced by
TRUE, FALSE and NULL must be lowercase; expected null, but found NULL.
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
256
				array_push($header_array, $header);
257
			}
258
		}
259
260
		if ($call == "create" ||
0 ignored issues
show
introduced by
No space after opening parenthesis is prohibited
Loading history...
introduced by
Found "== "". Use Yoda Condition checks, you must
Loading history...
Coding Style Comprehensibility introduced by
The string literal create does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
261
		$call == "merge" ||
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal merge does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
262
		$call == "query" ||
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal query does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
263
		$call == "retrieve" ||
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal retrieve does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
264
		$call == "update" ||
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal update does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
265
		$call == "upsert"
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal upsert does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
266
		) {
267
			$header = $this->mruHeader;
268
			if ($header != NULL) {
0 ignored issues
show
introduced by
No space after opening parenthesis is prohibited
Loading history...
Coding Style introduced by
TRUE, FALSE and NULL must be lowercase; expected null, but found NULL.
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
269
				array_push($header_array, $header);
270
			}
271
		}
272
273
		if ($call == "delete") {
0 ignored issues
show
introduced by
No space after opening parenthesis is prohibited
Loading history...
introduced by
Found "== "". Use Yoda Condition checks, you must
Loading history...
Coding Style Comprehensibility introduced by
The string literal delete does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
274
			$header = $this->userTerritoryDeleteHeader;
275
			if ($header != NULL) {
0 ignored issues
show
introduced by
No space after opening parenthesis is prohibited
Loading history...
Coding Style introduced by
TRUE, FALSE and NULL must be lowercase; expected null, but found NULL.
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
276
				array_push($header_array, $header);
277
			}
278
		}
279
280
		if ($call == "query" ||
0 ignored issues
show
introduced by
No space after opening parenthesis is prohibited
Loading history...
introduced by
Found "== "". Use Yoda Condition checks, you must
Loading history...
Coding Style Comprehensibility introduced by
The string literal query does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
281
		$call == "queryMore" ||
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal queryMore does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
282
		$call == "retrieve") {
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal retrieve does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
283
			$header = $this->queryHeader;
284
			if ($header != NULL) {
0 ignored issues
show
introduced by
No space after opening parenthesis is prohibited
Loading history...
Coding Style introduced by
TRUE, FALSE and NULL must be lowercase; expected null, but found NULL.
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
285
				array_push($header_array, $header);
286
			}
287
		}
288
		
289
		// try to add allowFieldTruncationHeader
290
		$allowFieldTruncationHeaderCalls = array(
291
			'convertLead', 'create', 'merge',
292
			'process', 'undelete', 'update',
293
			'upsert',
294
		);
295
		if (in_array($call, $allowFieldTruncationHeaderCalls)) {
0 ignored issues
show
introduced by
No space after opening parenthesis is prohibited
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
296
			$header = $this->allowFieldTruncationHeader;
297
			if ($header != NULL) {
0 ignored issues
show
introduced by
No space after opening parenthesis is prohibited
Loading history...
Coding Style introduced by
TRUE, FALSE and NULL must be lowercase; expected null, but found NULL.
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
298
				array_push($header_array, $header);
299
			}
300
		}
301
		
302
		// try to add localeOptions
303
		if ($call == 'describeSObject' || $call == 'describeSObjects') {
0 ignored issues
show
introduced by
No space after opening parenthesis is prohibited
Loading history...
introduced by
Found "== '". Use Yoda Condition checks, you must
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
304
			$header = $this->localeOptions;
305
			if ($header != NULL) {
0 ignored issues
show
introduced by
No space after opening parenthesis is prohibited
Loading history...
Coding Style introduced by
TRUE, FALSE and NULL must be lowercase; expected null, but found NULL.
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
306
				array_push($header_array, $header);
307
			}
308
		}
309
		
310
		// try to add PackageVersionHeader
311
		$packageVersionHeaderCalls = array(
312
			'convertLead', 'create', 'delete', 'describeGlobal',
313
			'describeLayout', 'describeSObject', 'describeSObjects',
314
			'describeSoftphoneLayout', 'describeTabs', 'merge',
315
			'process', 'query', 'retrieve', 'search', 'undelete',
316
			'update', 'upsert',
317
		);
318
		if(in_array($call, $packageVersionHeaderCalls)) {
0 ignored issues
show
introduced by
Space after opening control structure is required
Loading history...
introduced by
No space before opening parenthesis is prohibited
Loading history...
introduced by
No space after opening parenthesis is prohibited
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
319
			$header = $this->packageVersionHeader;
320
			if ($header != NULL) {
0 ignored issues
show
introduced by
No space after opening parenthesis is prohibited
Loading history...
Coding Style introduced by
TRUE, FALSE and NULL must be lowercase; expected null, but found NULL.
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
321
				array_push($header_array, $header);
322
			}
323
		}
324
		
0 ignored issues
show
Coding Style introduced by
Functions must not contain multiple empty lines in a row; found 2 empty lines
Loading history...
325
		
326
		$this->sforce->__setSoapHeaders($header_array);
327
	}
328
329
	public function setAssignmentRuleHeader($header) {
0 ignored issues
show
Coding Style introduced by
The function name setAssignmentRuleHeader is in camel caps, but expected set_assignment_rule_header instead as per the coding standard.
Loading history...
330
		if ($header != NULL) {
0 ignored issues
show
introduced by
No space after opening parenthesis is prohibited
Loading history...
Coding Style introduced by
TRUE, FALSE and NULL must be lowercase; expected null, but found NULL.
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
331
			$this->assignmentRuleHeader = new SoapHeader($this->namespace, 'AssignmentRuleHeader', array (
0 ignored issues
show
introduced by
There must be no space between the Array keyword and the opening parenthesis
Loading history...
332
			 'assignmentRuleId' => $header->assignmentRuleId,
0 ignored issues
show
Coding Style introduced by
This line of the multi-line function call does not seem to be indented correctly. Expected 16 spaces, but found 13.
Loading history...
333
			 'useDefaultRule' => $header->useDefaultRuleFlag
0 ignored issues
show
Coding Style introduced by
This line of the multi-line function call does not seem to be indented correctly. Expected 16 spaces, but found 13.
Loading history...
introduced by
Each line in an array declaration must end in a comma
Loading history...
334
			));
335
		} else {
336
			$this->assignmentRuleHeader = NULL;
0 ignored issues
show
Coding Style introduced by
TRUE, FALSE and NULL must be lowercase; expected null, but found NULL.
Loading history...
337
		}
338
	}
339
340
	public function setEmailHeader($header) {
0 ignored issues
show
Coding Style introduced by
The function name setEmailHeader is in camel caps, but expected set_email_header instead as per the coding standard.
Loading history...
341
		if ($header != NULL) {
0 ignored issues
show
introduced by
No space after opening parenthesis is prohibited
Loading history...
Coding Style introduced by
TRUE, FALSE and NULL must be lowercase; expected null, but found NULL.
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
342
			$this->emailHeader = new SoapHeader($this->namespace, 'EmailHeader', array (
0 ignored issues
show
introduced by
There must be no space between the Array keyword and the opening parenthesis
Loading history...
343
			 'triggerAutoResponseEmail' => $header->triggerAutoResponseEmail,
0 ignored issues
show
Coding Style introduced by
This line of the multi-line function call does not seem to be indented correctly. Expected 16 spaces, but found 13.
Loading history...
344
			 'triggerOtherEmail' => $header->triggerOtherEmail,
0 ignored issues
show
Coding Style introduced by
This line of the multi-line function call does not seem to be indented correctly. Expected 16 spaces, but found 13.
Loading history...
345
			 'triggerUserEmail' => $header->triggerUserEmail
0 ignored issues
show
Coding Style introduced by
This line of the multi-line function call does not seem to be indented correctly. Expected 16 spaces, but found 13.
Loading history...
introduced by
Each line in an array declaration must end in a comma
Loading history...
346
			));
347
		} else {
348
			$this->emailHeader = NULL;
0 ignored issues
show
Coding Style introduced by
TRUE, FALSE and NULL must be lowercase; expected null, but found NULL.
Loading history...
349
		}
350
	}
351
352
	public function setLoginScopeHeader($header) {
0 ignored issues
show
Coding Style introduced by
The function name setLoginScopeHeader is in camel caps, but expected set_login_scope_header instead as per the coding standard.
Loading history...
353
		if ($header != NULL) {
0 ignored issues
show
introduced by
No space after opening parenthesis is prohibited
Loading history...
Coding Style introduced by
TRUE, FALSE and NULL must be lowercase; expected null, but found NULL.
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
354
			$this->loginScopeHeader = new SoapHeader($this->namespace, 'LoginScopeHeader', array (
0 ignored issues
show
introduced by
There must be no space between the Array keyword and the opening parenthesis
Loading history...
355
		'organizationId' => $header->organizationId,
0 ignored issues
show
Coding Style introduced by
This line of the multi-line function call does not seem to be indented correctly. Expected 16 spaces, but found 8.
Loading history...
356
		'portalId' => $header->portalId
0 ignored issues
show
Coding Style introduced by
This line of the multi-line function call does not seem to be indented correctly. Expected 16 spaces, but found 8.
Loading history...
introduced by
Each line in an array declaration must end in a comma
Loading history...
357
			));
358
		} else {
359
			$this->loginScopeHeader = NULL;
0 ignored issues
show
Coding Style introduced by
TRUE, FALSE and NULL must be lowercase; expected null, but found NULL.
Loading history...
360
		}
361
		//$this->setHeaders('login');
362
	}
363
364
	public function setMruHeader($header) {
0 ignored issues
show
Coding Style introduced by
The function name setMruHeader is in camel caps, but expected set_mru_header instead as per the coding standard.
Loading history...
365
		if ($header != NULL) {
0 ignored issues
show
introduced by
No space after opening parenthesis is prohibited
Loading history...
Coding Style introduced by
TRUE, FALSE and NULL must be lowercase; expected null, but found NULL.
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
366
			$this->mruHeader = new SoapHeader($this->namespace, 'MruHeader', array (
0 ignored issues
show
introduced by
There must be no space between the Array keyword and the opening parenthesis
Loading history...
367
			 'updateMru' => $header->updateMruFlag
0 ignored issues
show
Coding Style introduced by
This line of the multi-line function call does not seem to be indented correctly. Expected 16 spaces, but found 13.
Loading history...
introduced by
Each line in an array declaration must end in a comma
Loading history...
368
			));
369
		} else {
370
			$this->mruHeader = NULL;
0 ignored issues
show
Coding Style introduced by
TRUE, FALSE and NULL must be lowercase; expected null, but found NULL.
Loading history...
371
		}
372
	}
373
374
	public function setSessionHeader($id) {
0 ignored issues
show
Coding Style introduced by
The function name setSessionHeader is in camel caps, but expected set_session_header instead as per the coding standard.
Loading history...
375
		if ($id != NULL) {
0 ignored issues
show
introduced by
No space after opening parenthesis is prohibited
Loading history...
Coding Style introduced by
TRUE, FALSE and NULL must be lowercase; expected null, but found NULL.
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
376
			$this->sessionHeader = new SoapHeader($this->namespace, 'SessionHeader', array (
0 ignored issues
show
introduced by
There must be no space between the Array keyword and the opening parenthesis
Loading history...
377
			 'sessionId' => $id
0 ignored issues
show
Coding Style introduced by
This line of the multi-line function call does not seem to be indented correctly. Expected 16 spaces, but found 13.
Loading history...
introduced by
Each line in an array declaration must end in a comma
Loading history...
378
			));
379
			$this->sessionId = $id;
380
		} else {
381
			$this->sessionHeader = NULL;
0 ignored issues
show
Coding Style introduced by
TRUE, FALSE and NULL must be lowercase; expected null, but found NULL.
Loading history...
382
			$this->sessionId = NULL;
0 ignored issues
show
Coding Style introduced by
TRUE, FALSE and NULL must be lowercase; expected null, but found NULL.
Loading history...
383
		}
384
	}
385
386 View Code Duplication
	public function setUserTerritoryDeleteHeader($header) {
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
Coding Style introduced by
The function name setUserTerritoryDeleteHeader is in camel caps, but expected set_user_territory_delete_header instead as per the coding standard.
Loading history...
387
		if ($header != NULL) {
0 ignored issues
show
introduced by
No space after opening parenthesis is prohibited
Loading history...
Coding Style introduced by
TRUE, FALSE and NULL must be lowercase; expected null, but found NULL.
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
388
			$this->userTerritoryDeleteHeader = new SoapHeader($this->namespace, 'UserTerritoryDeleteHeader  ', array (
0 ignored issues
show
introduced by
There must be no space between the Array keyword and the opening parenthesis
Loading history...
389
			 'transferToUserId' => $header->transferToUserId
0 ignored issues
show
Coding Style introduced by
This line of the multi-line function call does not seem to be indented correctly. Expected 16 spaces, but found 13.
Loading history...
introduced by
Each line in an array declaration must end in a comma
Loading history...
390
			));
391
		} else {
392
			$this->userTerritoryDeleteHeader = NULL;
0 ignored issues
show
Coding Style introduced by
TRUE, FALSE and NULL must be lowercase; expected null, but found NULL.
Loading history...
393
		}
394
	}
395
396
	public function setQueryOptions($header) {
0 ignored issues
show
Coding Style introduced by
The function name setQueryOptions is in camel caps, but expected set_query_options instead as per the coding standard.
Loading history...
397
		if ($header != NULL) {
0 ignored issues
show
introduced by
No space after opening parenthesis is prohibited
Loading history...
Coding Style introduced by
TRUE, FALSE and NULL must be lowercase; expected null, but found NULL.
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
398
			$this->queryHeader = new SoapHeader($this->namespace, 'QueryOptions', array (
0 ignored issues
show
introduced by
There must be no space between the Array keyword and the opening parenthesis
Loading history...
399
			 'batchSize' => $header->batchSize
0 ignored issues
show
Coding Style introduced by
This line of the multi-line function call does not seem to be indented correctly. Expected 16 spaces, but found 13.
Loading history...
introduced by
Each line in an array declaration must end in a comma
Loading history...
400
			));
401
		} else {
402
			$this->queryHeader = NULL;
0 ignored issues
show
Coding Style introduced by
TRUE, FALSE and NULL must be lowercase; expected null, but found NULL.
Loading history...
403
		}
404
	}
405
	
406 View Code Duplication
	public function setAllowFieldTruncationHeader($header) {
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
Coding Style introduced by
The function name setAllowFieldTruncationHeader is in camel caps, but expected set_allow_field_truncation_header instead as per the coding standard.
Loading history...
407
		if ($header != NULL) {
0 ignored issues
show
introduced by
No space after opening parenthesis is prohibited
Loading history...
Coding Style introduced by
TRUE, FALSE and NULL must be lowercase; expected null, but found NULL.
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
408
			$this->allowFieldTruncationHeader = new SoapHeader($this->namespace, 'AllowFieldTruncationHeader', array (
0 ignored issues
show
introduced by
There must be no space between the Array keyword and the opening parenthesis
Loading history...
409
					'allowFieldTruncation' => $header->allowFieldTruncation
0 ignored issues
show
introduced by
Each line in an array declaration must end in a comma
Loading history...
410
				)
411
			);
412
		} else {
413
			$this->allowFieldTruncationHeader = NULL;
0 ignored issues
show
Coding Style introduced by
TRUE, FALSE and NULL must be lowercase; expected null, but found NULL.
Loading history...
414
		}
415
	}
416
	
417 View Code Duplication
	public function setLocaleOptions($header) {
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
Coding Style introduced by
The function name setLocaleOptions is in camel caps, but expected set_locale_options instead as per the coding standard.
Loading history...
418
		if ($header != NULL) {
0 ignored issues
show
introduced by
No space after opening parenthesis is prohibited
Loading history...
Coding Style introduced by
TRUE, FALSE and NULL must be lowercase; expected null, but found NULL.
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
419
			$this->localeOptions = new SoapHeader($this->namespace, 'LocaleOptions',
420
				array (
0 ignored issues
show
introduced by
There must be no space between the Array keyword and the opening parenthesis
Loading history...
421
					'language' => $header->language
0 ignored issues
show
introduced by
Each line in an array declaration must end in a comma
Loading history...
422
				)
423
			);
424
		} else {
425
			$this->localeOptions = NULL;
0 ignored issues
show
Coding Style introduced by
TRUE, FALSE and NULL must be lowercase; expected null, but found NULL.
Loading history...
426
		}
427
	}
428
	
429
	/**
430
	 * @param $header
431
	 */
432
	public function setPackageVersionHeader($header) {
0 ignored issues
show
Coding Style introduced by
The function name setPackageVersionHeader is in camel caps, but expected set_package_version_header instead as per the coding standard.
Loading history...
433
		if ($header != NULL) {
0 ignored issues
show
introduced by
No space after opening parenthesis is prohibited
Loading history...
Coding Style introduced by
TRUE, FALSE and NULL must be lowercase; expected null, but found NULL.
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
434
			$headerData = array('packageVersions' => array());
0 ignored issues
show
introduced by
No space after opening parenthesis of array is bad style
Loading history...
introduced by
No space before closing parenthesis of array is bad style
Loading history...
435
			
436
			foreach ($header->packageVersions as $key => $hdrElem) {
0 ignored issues
show
introduced by
No space after opening parenthesis is prohibited
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
437
				$headerData['packageVersions'][] = array(
438
					'majorNumber' => $hdrElem->majorNumber,
439
					'minorNumber' => $hdrElem->minorNumber,
440
					'namespace' => $hdrElem->namespace,
441
				);
442
			}
443
			
444
			$this->packageVersionHeader = new SoapHeader($this->namespace,
445
				'PackageVersionHeader',
446
				$headerData
447
			);
448
		} else {
449
			$this->packageVersionHeader = NULL;
0 ignored issues
show
Coding Style introduced by
TRUE, FALSE and NULL must be lowercase; expected null, but found NULL.
Loading history...
450
		}
451
	}
452
453
	public function getSessionId() {
0 ignored issues
show
Coding Style introduced by
The function name getSessionId is in camel caps, but expected get_session_id instead as per the coding standard.
Loading history...
454
		return $this->sessionId;
455
	}
456
457
	public function getLocation() {
0 ignored issues
show
Coding Style introduced by
The function name getLocation is in camel caps, but expected get_location instead as per the coding standard.
Loading history...
458
		return $this->location;
459
	}
460
461
	public function getConnection() {
0 ignored issues
show
Coding Style introduced by
The function name getConnection is in camel caps, but expected get_connection instead as per the coding standard.
Loading history...
462
		return $this->sforce;
463
	}
464
465
	public function getFunctions() {
0 ignored issues
show
Coding Style introduced by
The function name getFunctions is in camel caps, but expected get_functions instead as per the coding standard.
Loading history...
466
		return $this->sforce->__getFunctions();
467
	}
468
469
	public function getTypes() {
0 ignored issues
show
Coding Style introduced by
The function name getTypes is in camel caps, but expected get_types instead as per the coding standard.
Loading history...
470
		return $this->sforce->__getTypes();
471
	}
472
473
	public function getLastRequest() {
0 ignored issues
show
Coding Style introduced by
The function name getLastRequest is in camel caps, but expected get_last_request instead as per the coding standard.
Loading history...
474
		return $this->sforce->__getLastRequest();
475
	}
476
477
	public function getLastRequestHeaders() {
0 ignored issues
show
Coding Style introduced by
The function name getLastRequestHeaders is in camel caps, but expected get_last_request_headers instead as per the coding standard.
Loading history...
478
		return $this->sforce->__getLastRequestHeaders();
479
	}
480
481
	public function getLastResponse() {
0 ignored issues
show
Coding Style introduced by
The function name getLastResponse is in camel caps, but expected get_last_response instead as per the coding standard.
Loading history...
482
		return $this->sforce->__getLastResponse();
483
	}
484
485
	public function getLastResponseHeaders() {
0 ignored issues
show
Coding Style introduced by
The function name getLastResponseHeaders is in camel caps, but expected get_last_response_headers instead as per the coding standard.
Loading history...
486
		return $this->sforce->__getLastResponseHeaders();
487
	}
488
489
	protected function _convertToAny($fields) {
0 ignored issues
show
Coding Style introduced by
The function name _convertToAny is in camel caps, but expected _convert_to_any instead as per the coding standard.
Loading history...
490
		$anyString = '';
491
		foreach ($fields as $key => $value) {
0 ignored issues
show
introduced by
No space after opening parenthesis is prohibited
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
492
			$anyString = $anyString . '<' . $key . '>' . $value . '</' . $key . '>';
493
		}
494
		return $anyString;
495
	}
496
497
	protected function _create($arg) {
498
		$this->setHeaders("create");
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal create does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
499
		return $this->sforce->create($arg)->result;
500
	}
501
502
	protected function _merge($arg) {
503
		$this->setHeaders("merge");
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal merge does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
504
		return $this->sforce->merge($arg)->result;
505
	}
506
507
	protected function _process($arg) {
508
		$this->setHeaders();
509
		return $this->sforce->process($arg)->result;
510
	}
511
512
	protected function _update($arg) {
513
		$this->setHeaders("update");
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal update does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
514
		return $this->sforce->update($arg)->result;
515
	}
516
517
	protected function _upsert($arg) {
518
		$this->setHeaders("upsert");
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal upsert does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
519
		return $this->sforce->upsert($arg)->result;
520
	}
521
522 View Code Duplication
  public function sendSingleEmail($request) {
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
Coding Style introduced by
The function name sendSingleEmail is in camel caps, but expected send_single_email instead as per the coding standard.
Loading history...
523
	if (is_array($request)) {
0 ignored issues
show
introduced by
No space after opening parenthesis is prohibited
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
524
	  $messages = array();
525
	  foreach ($request as $r) {
0 ignored issues
show
introduced by
No space after opening parenthesis is prohibited
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
526
		$email = new SoapVar($r, SOAP_ENC_OBJECT, 'SingleEmailMessage', $this->namespace);
527
		array_push($messages, $email);
528
	  }
529
	  $arg = new stdClass();
530
	  $arg->messages = $messages;
531
	  return $this->_sendEmail($arg);
532
	} else {
533
	  $backtrace = debug_backtrace();
534
	  die('Please pass in array to this function:  '.$backtrace[0]['function']);
535
	}
536
  }
537
538 View Code Duplication
  public function sendMassEmail($request) {
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
Coding Style introduced by
The function name sendMassEmail is in camel caps, but expected send_mass_email instead as per the coding standard.
Loading history...
539
	if (is_array($request)) {
0 ignored issues
show
introduced by
No space after opening parenthesis is prohibited
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
540
	  $messages = array();
541
	  foreach ($request as $r) {
0 ignored issues
show
introduced by
No space after opening parenthesis is prohibited
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
542
		$email = new SoapVar($r, SOAP_ENC_OBJECT, 'MassEmailMessage', $this->namespace);
543
		array_push($messages, $email);
544
	  }
545
	  $arg = new stdClass();
546
	  $arg->messages = $messages;
547
	  return $this->_sendEmail($arg);
548
	} else {
549
	  $backtrace = debug_backtrace();
550
	  die('Please pass in array to this function:  '.$backtrace[0]['function']);
551
	}
552
  } 
553
	
554
	protected function _sendEmail($arg) {
0 ignored issues
show
Coding Style introduced by
The function name _sendEmail is in camel caps, but expected _send_email instead as per the coding standard.
Loading history...
555
		$this->setHeaders();
556
		return $this->sforce->sendEmail($arg)->result;
557
	}
558
559
	/**
560
	 * Converts a Lead into an Account, Contact, or (optionally) an Opportunity.
561
	 *
562
	 * @param array $leadConverts    Array of LeadConvert
563
	 *
564
	 * @return LeadConvertResult
565
	 */
566
	public function convertLead($leadConverts) {
0 ignored issues
show
Coding Style introduced by
The function name convertLead is in camel caps, but expected convert_lead instead as per the coding standard.
Loading history...
567
		$this->setHeaders("convertLead");
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal convertLead does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
568
		$arg = new stdClass();
569
		$arg->leadConverts = $leadConverts;
570
		return $this->sforce->convertLead($arg);
571
	}
572
573
	/**
574
	 * Deletes one or more new individual objects to your organization's data.
575
	 *
576
	 * @param array $ids    Array of fields
577
	 * @return DeleteResult
578
	 */
579
	public function delete($ids) {
580
		$this->setHeaders("delete");
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal delete does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
581
		if(count($ids) > 200) {
0 ignored issues
show
introduced by
Space after opening control structure is required
Loading history...
introduced by
No space before opening parenthesis is prohibited
Loading history...
introduced by
No space after opening parenthesis is prohibited
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
582
			$result = array();
583
			$chunked_ids = array_chunk($ids, 200);
584
			foreach($chunked_ids as $cids) {
0 ignored issues
show
introduced by
Space after opening control structure is required
Loading history...
introduced by
No space before opening parenthesis is prohibited
Loading history...
introduced by
No space after opening parenthesis is prohibited
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
585
				$arg = new stdClass;
586
				$arg->ids = $cids;
587
				$result = array_merge($result, $this->sforce->delete($arg)->result);
588
			}
589
		} else {
590
			$arg = new stdClass;
591
			$arg->ids = $ids;
592
			$result = $this->sforce->delete($arg)->result;
593
		}
594
		return $result;
595
	}
596
597
	/**
598
	 * Deletes one or more new individual objects to your organization's data.
599
	 *
600
	 * @param array $ids    Array of fields
601
	 * @return DeleteResult
602
	 */
603 View Code Duplication
	public function undelete($ids) {
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
604
		$this->setHeaders("undelete");
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal undelete does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
605
		$arg = new stdClass();
606
		$arg->ids = $ids;
607
		return $this->sforce->undelete($arg)->result;
608
	}
609
610
	/**
611
	 * Deletes one or more new individual objects to your organization's data.
612
	 *
613
	 * @param array $ids    Array of fields
614
	 * @return DeleteResult
615
	 */
616 View Code Duplication
	public function emptyRecycleBin($ids) {
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
Coding Style introduced by
The function name emptyRecycleBin is in camel caps, but expected empty_recycle_bin instead as per the coding standard.
Loading history...
617
		$this->setHeaders();
618
		$arg = new stdClass();
619
		$arg->ids = $ids;
620
		return $this->sforce->emptyRecycleBin($arg)->result;
621
	}
622
623
	/**
624
	 * Process Submit Request for Approval
625
	 *
626
	 * @param array $processRequestArray
627
	 * @return ProcessResult
628
	 */
629 View Code Duplication
	public function processSubmitRequest($processRequestArray) {
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
Coding Style introduced by
The function name processSubmitRequest is in camel caps, but expected process_submit_request instead as per the coding standard.
Loading history...
630
		if (is_array($processRequestArray)) {
0 ignored issues
show
introduced by
No space after opening parenthesis is prohibited
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
631
			foreach ($processRequestArray as &$process) {
0 ignored issues
show
introduced by
No space after opening parenthesis is prohibited
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
632
				$process = new SoapVar($process, SOAP_ENC_OBJECT, 'ProcessSubmitRequest', $this->namespace);
633
			}
634
			$arg = new stdClass();
635
			$arg->actions = $processRequestArray;
636
			return $this->_process($arg);
637
		} else {
638
			$backtrace = debug_backtrace();
639
			die('Please pass in array to this function:  '.$backtrace[0]['function']);
640
		}
641
	}
642
643
	/**
644
	 * Process Work Item Request for Approval
645
	 *
646
	 * @param array $processRequestArray
647
	 * @return ProcessResult
648
	 */
649 View Code Duplication
	public function processWorkitemRequest($processRequestArray) {
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
Coding Style introduced by
The function name processWorkitemRequest is in camel caps, but expected process_workitem_request instead as per the coding standard.
Loading history...
650
		if (is_array($processRequestArray)) {
0 ignored issues
show
introduced by
No space after opening parenthesis is prohibited
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
651
			foreach ($processRequestArray as &$process) {
0 ignored issues
show
introduced by
No space after opening parenthesis is prohibited
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
652
				$process = new SoapVar($process, SOAP_ENC_OBJECT, 'ProcessWorkitemRequest', $this->namespace);
653
			}
654
			$arg = new stdClass();
655
			$arg->actions = $processRequestArray;
656
			return $this->_process($arg);
657
		} else {
658
			$backtrace = debug_backtrace();
659
			die('Please pass in array to this function:  '.$backtrace[0]['function']);
660
		}
661
	}
662
663
	/**
664
	 * Retrieves a list of available objects for your organization's data.
665
	 *
666
	 * @return DescribeGlobalResult
667
	 */
668
	public function describeGlobal() {
0 ignored issues
show
Coding Style introduced by
The function name describeGlobal is in camel caps, but expected describe_global instead as per the coding standard.
Loading history...
669
		$this->setHeaders("describeGlobal");
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal describeGlobal does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
670
		return $this->sforce->describeGlobal()->result;
671
	}
672
673
	/**
674
	 * Use describeLayout to retrieve information about the layout (presentation
675
	 * of data to users) for a given object type. The describeLayout call returns
676
	 * metadata about a given page layout, including layouts for edit and
677
	 * display-only views and record type mappings. Note that field-level security
678
	 * and layout editability affects which fields appear in a layout.
679
	 *
680
	 * @param string Type   Object Type
681
	 * @return DescribeLayoutResult
682
	 */
683
	public function describeLayout($type, array $recordTypeIds=null) {
0 ignored issues
show
Coding Style introduced by
The function name describeLayout is in camel caps, but expected describe_layout instead as per the coding standard.
Loading history...
introduced by
Expected 1 space between argument "$recordTypeIds" and equals sign; 0 found
Loading history...
introduced by
Expected 1 space between default value and equals sign for argument "$recordTypeIds";
Loading history...
684
		$this->setHeaders("describeLayout");
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal describeLayout does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
685
		$arg = new stdClass();
686
		$arg->sObjectType = new SoapVar($type, XSD_STRING, 'string', 'http://www.w3.org/2001/XMLSchema');
687
		if (isset($recordTypeIds) && count($recordTypeIds)) 
0 ignored issues
show
Coding Style Best Practice introduced by
It is generally a best practice to always use braces with control structures.

Adding braces to control structures avoids accidental mistakes as your code changes:

// Without braces (not recommended)
if (true)
    doSomething();

// Recommended
if (true) {
    doSomething();
}
Loading history...
688
			$arg->recordTypeIds = $recordTypeIds;
689
		return $this->sforce->describeLayout($arg)->result;
690
	}
691
692
	/**
693
	 * Describes metadata (field list and object properties) for the specified
694
	 * object.
695
	 *
696
	 * @param string $type    Object type
697
	 * @return DescribsSObjectResult
698
	 */
699 View Code Duplication
	public function describeSObject($type) {
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
Coding Style introduced by
The function name describeSObject is in camel caps, but expected describe_s_object instead as per the coding standard.
Loading history...
700
		$this->setHeaders("describeSObject");
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal describeSObject does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
701
		$arg = new stdClass();
702
		$arg->sObjectType = new SoapVar($type, XSD_STRING, 'string', 'http://www.w3.org/2001/XMLSchema');
703
		return $this->sforce->describeSObject($arg)->result;
704
	}
705
706
	/**
707
	 * An array-based version of describeSObject; describes metadata (field list
708
	 * and object properties) for the specified object or array of objects.
709
	 *
710
	 * @param array $arrayOfTypes    Array of object types.
711
	 * @return DescribsSObjectResult
712
	 */
713
	public function describeSObjects($arrayOfTypes) {
0 ignored issues
show
Coding Style introduced by
The function name describeSObjects is in camel caps, but expected describe_s_objects instead as per the coding standard.
Loading history...
714
		$this->setHeaders("describeSObjects");
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal describeSObjects does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
715
		return $this->sforce->describeSObjects($arrayOfTypes)->result;
716
	}
717
718
	/**
719
	 * The describeTabs call returns information about the standard apps and
720
	 * custom apps, if any, available for the user who sends the call, including
721
	 * the list of tabs defined for each app.
722
	 *
723
	 * @return DescribeTabSetResult
724
	 */
725
	public function describeTabs() {
0 ignored issues
show
Coding Style introduced by
The function name describeTabs is in camel caps, but expected describe_tabs instead as per the coding standard.
Loading history...
726
		$this->setHeaders("describeTabs");
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal describeTabs does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
727
		return $this->sforce->describeTabs()->result;
728
	}
729
730
	/**
731
	 * To enable data categories groups you must enable Answers or Knowledge Articles module in
732
	 * admin panel, after adding category group and assign it to Answers or Knowledge Articles
733
	 *
734
	 * @param string $sObjectType   sObject Type
735
	 * @return DescribeDataCategoryGroupResult
736
	 */
737 View Code Duplication
	public function describeDataCategoryGroups($sObjectType) {
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
Coding Style introduced by
The function name describeDataCategoryGroups is in camel caps, but expected describe_data_category_groups instead as per the coding standard.
Loading history...
738
		$this->setHeaders('describeDataCategoryGroups');
739
		$arg = new stdClass();
740
		$arg->sObjectType = new SoapVar($sObjectType, XSD_STRING, 'string', 'http://www.w3.org/2001/XMLSchema');
741
		return $this->sforce->describeDataCategoryGroups($arg)->result;
742
	}
743
744
	/**
745
	 * Retrieves available category groups along with their data category structure for objects specified in the request.
746
	 *
747
	 * @param DataCategoryGroupSobjectTypePair $pairs 
748
	 * @param bool $topCategoriesOnly   Object Type
749
	 * @return DescribeLayoutResult
750
	 */
751
	public function describeDataCategoryGroupStructures(array $pairs, $topCategoriesOnly) {
0 ignored issues
show
Coding Style introduced by
The function name describeDataCategoryGroupStructures is in camel caps, but expected describe_data_category_group_structures instead as per the coding standard.
Loading history...
752
		$this->setHeaders('describeDataCategoryGroupStructures');
753
		$arg = new stdClass();
754
		$arg->pairs = $pairs;
755
		$arg->topCategoriesOnly = new SoapVar($topCategoriesOnly, XSD_BOOLEAN, 'boolean', 'http://www.w3.org/2001/XMLSchema');
756
757
		return $this->sforce->describeDataCategoryGroupStructures($arg)->result;
758
	}
759
760
	/**
761
	 * Retrieves the list of individual objects that have been deleted within the
762
	 * given timespan for the specified object.
763
	 *
764
	 * @param string $type    Ojbect type
765
	 * @param date $startDate  Start date
766
	 * @param date $endDate   End Date
767
	 * @return GetDeletedResult
768
	 */
769 View Code Duplication
	public function getDeleted($type, $startDate, $endDate) {
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
Coding Style introduced by
The function name getDeleted is in camel caps, but expected get_deleted instead as per the coding standard.
Loading history...
770
		$this->setHeaders("getDeleted");
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal getDeleted does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
771
		$arg = new stdClass();
772
		$arg->sObjectType = new SoapVar($type, XSD_STRING, 'string', 'http://www.w3.org/2001/XMLSchema');
773
		$arg->startDate = $startDate;
774
		$arg->endDate = $endDate;
775
		return $this->sforce->getDeleted($arg)->result;
776
	}
777
778
	/**
779
	 * Retrieves the list of individual objects that have been updated (added or
780
	 * changed) within the given timespan for the specified object.
781
	 *
782
	 * @param string $type    Ojbect type
783
	 * @param date $startDate  Start date
784
	 * @param date $endDate   End Date
785
	 * @return GetUpdatedResult
786
	 */
787 View Code Duplication
	public function getUpdated($type, $startDate, $endDate) {
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
Coding Style introduced by
The function name getUpdated is in camel caps, but expected get_updated instead as per the coding standard.
Loading history...
788
		$this->setHeaders("getUpdated");
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal getUpdated does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
789
		$arg = new stdClass();
790
		$arg->sObjectType = new SoapVar($type, XSD_STRING, 'string', 'http://www.w3.org/2001/XMLSchema');
791
		$arg->startDate = $startDate;
792
		$arg->endDate = $endDate;
793
		return $this->sforce->getUpdated($arg)->result;
794
	}
795
796
	/**
797
	 * Executes a query against the specified object and returns data that matches
798
	 * the specified criteria.
799
	 *
800
	 * @param String $query Query String
801
	 * @param QueryOptions $queryOptions  Batch size limit.  OPTIONAL
0 ignored issues
show
Bug introduced by
There is no parameter named $queryOptions. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
802
	 * @return QueryResult
803
	 */
804 View Code Duplication
	public function query($query) {
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
805
		$this->setHeaders("query");
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal query does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
806
		$raw = $this->sforce->query(array (
0 ignored issues
show
introduced by
There must be no space between the Array keyword and the opening parenthesis
Loading history...
807
					  'queryString' => $query
0 ignored issues
show
introduced by
Each line in an array declaration must end in a comma
Loading history...
808
		))->result;
809
		$QueryResult = new QueryResult($raw);
810
		$QueryResult->setSf($this); // Dependency Injection
811
		return $QueryResult;
812
	}
813
814
	/**
815
	 * Retrieves the next batch of objects from a query.
816
	 *
817
	 * @param QueryLocator $queryLocator Represents the server-side cursor that tracks the current processing location in the query result set.
818
	 * @param QueryOptions $queryOptions  Batch size limit.  OPTIONAL
0 ignored issues
show
Bug introduced by
There is no parameter named $queryOptions. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
819
	 * @return QueryResult
820
	 */
821
	public function queryMore($queryLocator) {
0 ignored issues
show
Coding Style introduced by
The function name queryMore is in camel caps, but expected query_more instead as per the coding standard.
Loading history...
822
		$this->setHeaders("queryMore");
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal queryMore does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
823
		$arg = new stdClass();
824
		$arg->queryLocator = $queryLocator;
825
		$raw = $this->sforce->queryMore($arg)->result;
826
		$QueryResult = new QueryResult($raw);
827
		$QueryResult->setSf($this); // Dependency Injection
828
		return $QueryResult;
829
	}
830
831
	/**
832
	 * Retrieves data from specified objects, whether or not they have been deleted.
833
	 *
834
	 * @param String $query Query String
835
	 * @param QueryOptions $queryOptions  Batch size limit.  OPTIONAL
836
	 * @return QueryResult
837
	 */
838 View Code Duplication
	public function queryAll($query, $queryOptions = NULL) {
0 ignored issues
show
Unused Code introduced by
The parameter $queryOptions is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
Coding Style introduced by
The function name queryAll is in camel caps, but expected query_all instead as per the coding standard.
Loading history...
Coding Style introduced by
TRUE, FALSE and NULL must be lowercase; expected null, but found NULL.
Loading history...
839
		$this->setHeaders("queryAll");
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal queryAll does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
840
		$raw = $this->sforce->queryAll(array (
0 ignored issues
show
introduced by
There must be no space between the Array keyword and the opening parenthesis
Loading history...
841
						'queryString' => $query
0 ignored issues
show
introduced by
Each line in an array declaration must end in a comma
Loading history...
842
		))->result;
843
		$QueryResult = new QueryResult($raw);
844
		$QueryResult->setSf($this); // Dependency Injection
845
		return $QueryResult;
846
	}
847
848
849
	/**
850
	 * Retrieves one or more objects based on the specified object IDs.
851
	 *
852
	 * @param string $fieldList      One or more fields separated by commas.
853
	 * @param string $sObjectType    Object from which to retrieve data.
854
	 * @param array $ids            Array of one or more IDs of the objects to retrieve.
855
	 * @return sObject[]
856
	 */
857 View Code Duplication
	public function retrieve($fieldList, $sObjectType, $ids) {
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
858
		$this->setHeaders("retrieve");
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal retrieve does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
859
		$arg = new stdClass();
860
		$arg->fieldList = $fieldList;
861
		$arg->sObjectType = new SoapVar($sObjectType, XSD_STRING, 'string', 'http://www.w3.org/2001/XMLSchema');
862
		$arg->ids = $ids;
863
		return $this->sforce->retrieve($arg)->result;
864
	}
865
866
	/**
867
	 * Executes a text search in your organization's data.
868
	 *
869
	 * @param string $searchString   Search string that specifies the text expression to search for.
870
	 * @return SearchResult
871
	 */
872 View Code Duplication
	public function search($searchString) {
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
873
		$this->setHeaders("search");
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal search does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
874
		$arg = new stdClass();
875
		$arg->searchString = new SoapVar($searchString, XSD_STRING, 'string', 'http://www.w3.org/2001/XMLSchema');
876
		return new SforceSearchResult($this->sforce->search($arg)->result);
877
	}
878
879
	/**
880
	 * Retrieves the current system timestamp (GMT) from the Web service.
881
	 *
882
	 * @return timestamp
883
	 */
884
	public function getServerTimestamp() {
0 ignored issues
show
Coding Style introduced by
The function name getServerTimestamp is in camel caps, but expected get_server_timestamp instead as per the coding standard.
Loading history...
885
		$this->setHeaders("getServerTimestamp");
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal getServerTimestamp does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
886
		return $this->sforce->getServerTimestamp()->result;
887
	}
888
889
	public function getUserInfo() {
0 ignored issues
show
Coding Style introduced by
The function name getUserInfo is in camel caps, but expected get_user_info instead as per the coding standard.
Loading history...
890
		$this->setHeaders("getUserInfo");
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal getUserInfo does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
891
		return $this->sforce->getUserInfo()->result;
892
	}
893
894
	/**
895
	 * Sets the specified user's password to the specified value.
896
	 *
897
	 * @param string $userId    ID of the User.
898
	 * @param string $password  New password
899
	 */
900 View Code Duplication
	public function setPassword($userId, $password) {
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
Coding Style introduced by
The function name setPassword is in camel caps, but expected set_password instead as per the coding standard.
Loading history...
901
		$this->setHeaders("setPassword");
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal setPassword does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
902
		$arg = new stdClass();
903
		$arg->userId = new SoapVar($userId, XSD_STRING, 'string', 'http://www.w3.org/2001/XMLSchema');
904
		$arg->password = $password;
905
		return $this->sforce->setPassword($arg);
906
	}
907
908
	/**
909
	 * Changes a user's password to a system-generated value.
910
	 *
911
	 * @param string $userId    Id of the User
912
	 * @return password
913
	 */
914 View Code Duplication
	public function resetPassword($userId) {
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
Coding Style introduced by
The function name resetPassword is in camel caps, but expected reset_password instead as per the coding standard.
Loading history...
915
		$this->setHeaders("resetPassword");
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal resetPassword does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
916
		$arg = new stdClass();
917
		$arg->userId = new SoapVar($userId, XSD_STRING, 'string', 'http://www.w3.org/2001/XMLSchema');
918
		return $this->sforce->resetPassword($arg)->result;
919
	}
920
}
921
922
class SforceSearchResult {
923
	public $searchRecords;
924
925
	public function __construct($response) {
926
927
		if($response instanceof SforceSearchResult) {
0 ignored issues
show
introduced by
Space after opening control structure is required
Loading history...
introduced by
No space before opening parenthesis is prohibited
Loading history...
introduced by
No space after opening parenthesis is prohibited
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
928
			$this->searchRecords = $response->searchRecords;
929
		} else {
930
			$this->searchRecords = array();
931
			if (isset($response->searchRecords)) {
0 ignored issues
show
introduced by
No space after opening parenthesis is prohibited
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
932
				if (is_array($response->searchRecords)) {
0 ignored issues
show
introduced by
No space after opening parenthesis is prohibited
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
933
					foreach ($response->searchRecords as $record) {
0 ignored issues
show
introduced by
No space after opening parenthesis is prohibited
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
934
						$sobject = new SObject($record->record);
935
						array_push($this->searchRecords, $sobject);
936
					};
937
				} else {
938
					$sobject = new SObject($response->searchRecords->record);
939
					array_push($this->records, $sobject);
940
				}
941
			}
942
		}
943
	}
944
}
945
946
class QueryResult implements Iterator{
947
	public $queryLocator;
948
	public $done;
949
	public $records;
950
	public $size;
951
952
	public $pointer; // Current iterator location
953
	private $sf; // SOAP Client
954
	
955
	public function __construct($response) {
956
		$this->queryLocator = $response->queryLocator;
957
		$this->done = $response->done;
958
		$this->size = $response->size;
959
		
960
		$this->pointer = 0;
961
		$this->sf = false;
962
963
		if($response instanceof QueryResult) {
0 ignored issues
show
introduced by
Space after opening control structure is required
Loading history...
introduced by
No space before opening parenthesis is prohibited
Loading history...
introduced by
No space after opening parenthesis is prohibited
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
964
			$this->records = $response->records;
965
		} else {
966
			$this->records = array();
967
			if (isset($response->records)) {
0 ignored issues
show
introduced by
No space after opening parenthesis is prohibited
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
968
				if (is_array($response->records)) {
0 ignored issues
show
introduced by
No space after opening parenthesis is prohibited
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
969
					foreach ($response->records as $record) {
0 ignored issues
show
introduced by
No space after opening parenthesis is prohibited
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
970
						array_push($this->records, $record);
971
					};
972
				} else {
973
					array_push($this->records, $record);
974
				}
975
			}
976
		}
977
	}
978
	
979
	public function setSf(SforceBaseClient $sf) { $this->sf = $sf; } // Dependency Injection
0 ignored issues
show
Coding Style introduced by
The function name setSf is in camel caps, but expected set_sf instead as per the coding standard.
Loading history...
980
	
981
	// Basic Iterator implementation functions
982
	public function rewind() { $this->pointer = 0; }
983
	public function next() { ++$this->pointer; }
984
	public function key() { return $this->pointer; }
985
	public function current() { return new SObject($this->records[$this->pointer]); }
0 ignored issues
show
introduced by
Array keys should be surrounded by spaces unless they contain a string or an integer.
Loading history...
986
	
987
	public function valid() {
988
		while ($this->pointer >= count($this->records)) {
0 ignored issues
show
introduced by
No space after opening parenthesis is prohibited
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
989
			// Pointer is larger than (current) result set; see if we can fetch more
990
			if ($this->done === false) {
0 ignored issues
show
introduced by
No space after opening parenthesis is prohibited
Loading history...
introduced by
Found "=== false". Use Yoda Condition checks, you must
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
991
				if ($this->sf === false) throw new Exception("Dependency not met!");
0 ignored issues
show
introduced by
Found "=== false". Use Yoda Condition checks, you must
Loading history...
Coding Style Best Practice introduced by
It is generally a best practice to always use braces with control structures.

Adding braces to control structures avoids accidental mistakes as your code changes:

// Without braces (not recommended)
if (true)
    doSomething();

// Recommended
if (true) {
    doSomething();
}
Loading history...
Coding Style Comprehensibility introduced by
The string literal Dependency not met! does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
992
				$response = $this->sf->queryMore($this->queryLocator);
993
				$this->records = array_merge($this->records, $response->records); // Append more results
994
				$this->done = $response->done;
995
				$this->queryLocator = $response->queryLocator;
996
			} else {
997
				return false; // No more records to fetch
998
			}
999
		}
1000
		if (isset($this->records[$this->pointer])) return true;
0 ignored issues
show
Coding Style Best Practice introduced by
It is generally a best practice to always use braces with control structures.

Adding braces to control structures avoids accidental mistakes as your code changes:

// Without braces (not recommended)
if (true)
    doSomething();

// Recommended
if (true) {
    doSomething();
}
Loading history...
introduced by
Array keys should be surrounded by spaces unless they contain a string or an integer.
Loading history...
1001
		
1002
		throw new Exception("QueryResult has gaps in the record data?");
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal QueryResult has gaps in the record data? does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
1003
	}
1004
}
1005
1006
class SObject {
1007
	public $type;
1008
	public $fields;
1009
//	public $sobject;
1010
1011
	public function __construct($response=NULL) {
0 ignored issues
show
introduced by
Expected 1 space between argument "$response" and equals sign; 0 found
Loading history...
introduced by
Expected 1 space between default value and equals sign for argument "$response";
Loading history...
Coding Style introduced by
TRUE, FALSE and NULL must be lowercase; expected null, but found NULL.
Loading history...
1012
		if (!isset($response) && !$response) {
0 ignored issues
show
introduced by
No space after opening parenthesis is prohibited
Loading history...
introduced by
Expected 1 space before "!"; 0 found
Loading history...
introduced by
Expected 1 space after "!"; 0 found
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
1013
			return;
1014
		}
1015
1016
		foreach ($response as $responseKey => $responseValue) {
0 ignored issues
show
introduced by
No space after opening parenthesis is prohibited
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
1017
			if (in_array(strval($responseKey), array('Id', 'type', 'any'))) {
0 ignored issues
show
introduced by
No space after opening parenthesis is prohibited
Loading history...
introduced by
No space after opening parenthesis of array is bad style
Loading history...
introduced by
No space before closing parenthesis of array is bad style
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
1018
				continue;
1019
			}
1020
			$this->$responseKey = $responseValue;
1021
		}
1022
1023
		if (isset($response->Id)) {
0 ignored issues
show
introduced by
No space after opening parenthesis is prohibited
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
1024
			$this->Id = is_array($response->Id) ? $response->Id[0] : $response->Id;
1025
		}
1026
1027
		if (isset($response->type)) {
0 ignored issues
show
introduced by
No space after opening parenthesis is prohibited
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
1028
			$this->type = $response->type;
1029
		}
1030
1031
		if (isset($response->any)) {
0 ignored issues
show
introduced by
No space after opening parenthesis is prohibited
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
1032
			try {
1033
				//$this->fields = $this->convertFields($response->any);
1034
				// If ANY is an object, instantiate another SObject
1035
				if ($response->any instanceof stdClass) {
0 ignored issues
show
introduced by
No space after opening parenthesis is prohibited
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
1036
					if ($this->isSObject($response->any)) {
0 ignored issues
show
introduced by
No space after opening parenthesis is prohibited
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
1037
						$anArray = array();
1038
						$sobject = new SObject($response->any);
1039
						$anArray[] = $sobject;
1040
						$this->sobjects = $anArray;
1041
					} else {
1042
						// this is for parent to child relationships
1043
						$this->queryResult = new QueryResult($response->any);
1044
					}
0 ignored issues
show
introduced by
Blank line found after control structure
Loading history...
1045
1046
				} else {
1047
					// If ANY is an array
1048
					if (is_array($response->any)) {
0 ignored issues
show
introduced by
No space after opening parenthesis is prohibited
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
1049
						// Loop through each and perform some action.
1050
						$anArray = array();
1051
1052
						// Modify the foreach to have $key=>$value
1053
						// Added on 28th April 2008
1054
						foreach ($response->any as $key=>$item) {
0 ignored issues
show
introduced by
No space after opening parenthesis is prohibited
Loading history...
introduced by
Expected 1 space before "=>"; 0 found
Loading history...
introduced by
Expected 1 space after "=>"; 0 found
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
1055
							if ($item instanceof stdClass) {
0 ignored issues
show
introduced by
No space after opening parenthesis is prohibited
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
1056
								if ($this->isSObject($item)) {
0 ignored issues
show
introduced by
No space after opening parenthesis is prohibited
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
1057
									$sobject = new SObject($item);
1058
									// make an associative array instead of a numeric one
1059
									$anArray[$key] = $sobject;
0 ignored issues
show
introduced by
Array keys should be surrounded by spaces unless they contain a string or an integer.
Loading history...
1060
								} else {
1061
									// this is for parent to child relationships
1062
									//$this->queryResult = new QueryResult($item);
1063
									if (!isset($this->queryResult)) {
0 ignored issues
show
introduced by
No space after opening parenthesis is prohibited
Loading history...
introduced by
Expected 1 space before "!"; 0 found
Loading history...
introduced by
Expected 1 space after "!"; 0 found
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
1064
										$this->queryResult = array();
1065
									}
1066
									array_push($this->queryResult, new QueryResult($item));
1067
								}
1068
							} else {
1069
								//$this->fields = $this->convertFields($item);
1070
1071
								if (strpos($item, 'sf:') === false) {
0 ignored issues
show
introduced by
No space after opening parenthesis is prohibited
Loading history...
introduced by
Found "=== false". Use Yoda Condition checks, you must
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
1072
									$currentXmlValue = sprintf('<sf:%s>%s</sf:%s>', $key, $item, $key);
1073
								} else {
1074
									$currentXmlValue = $item;
1075
								}
1076
1077
								if (!isset($fieldsToConvert)) {
0 ignored issues
show
introduced by
No space after opening parenthesis is prohibited
Loading history...
introduced by
Expected 1 space before "!"; 0 found
Loading history...
introduced by
Expected 1 space after "!"; 0 found
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
1078
									$fieldsToConvert = $currentXmlValue;
1079
								} else {
1080
									$fieldsToConvert .= $currentXmlValue;
1081
								}
1082
							}
1083
						}
1084
1085
						if (isset($fieldsToConvert)) {
0 ignored issues
show
introduced by
No space after opening parenthesis is prohibited
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
1086
							// If this line is commented, then the fields becomes a stdclass object and does not have the name variable
1087
							// In this case the foreach loop on line 252 runs successfuly
1088
							$this->fields = $this->convertFields($fieldsToConvert);
1089
						}
1090
1091
						if (sizeof($anArray) > 0) {
0 ignored issues
show
introduced by
No space after opening parenthesis is prohibited
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
1092
							// To add more variables to the the top level sobject
1093
							foreach ($anArray as $key=>$children_sobject) {
0 ignored issues
show
introduced by
No space after opening parenthesis is prohibited
Loading history...
introduced by
Expected 1 space before "=>"; 0 found
Loading history...
introduced by
Expected 1 space after "=>"; 0 found
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
1094
								$this->fields->$key = $children_sobject;
1095
							}
1096
							//array_push($this->fields, $anArray);
1097
							// Uncommented on 28th April since all the sobjects have now been moved to the fields
1098
							//$this->sobjects = $anArray;
1099
						}
1100
1101
						/*
1102
						   $this->fields = $this->convertFields($response->any[0]);
1103
						   if (isset($response->any[1]->records)) {
1104
						   $anArray = array();
1105
						   if ($response->any[1]->size == 1) {
1106
						   $records = array (
1107
						   $response->any[1]->records
1108
						   );
1109
						   } else {
1110
						   $records = $response->any[1]->records;
1111
						   }
1112
						   foreach ($records as $record) {
1113
						   $sobject = new SObject($record);
1114
						   array_push($anArray, $sobject);
1115
						   }
1116
						   $this->sobjects = $anArray;
1117
						   } else {
1118
						   $anArray = array();
1119
						   $sobject = new SObject($response->any[1]);
1120
						   array_push($anArray, $sobject);
1121
						   $this->sobjects = $anArray;
1122
						   }
1123
						 */
1124
					} else {
1125
						$this->fields = $this->convertFields($response->any);
1126
					}
1127
				}
1128
			} catch (Exception $e) {
1129
				var_dump('exception: ', $e);
0 ignored issues
show
Security Debugging Code introduced by
var_dump('exception: ', $e); looks like debug code. Are you sure you do not want to remove it? This might expose sensitive data.
Loading history...
introduced by
The use of function var_dump() is discouraged
Loading history...
1130
			}
1131
		}
1132
	}
1133
	
1134
	function __get($name) {	return (isset($this->fields->$name))? $this->fields->$name : false; }
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
1135
	function __isset($name) { return isset($this->fields->$name); }
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
1136
1137
	/**
1138
	 * Parse the "any" string from an sObject.  First strip out the sf: and then
1139
	 * enclose string with <Object></Object>.  Load the string using
1140
	 * simplexml_load_string and return an array that can be traversed.
1141
	 */
1142
	function convertFields($any) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
Coding Style introduced by
The function name convertFields is in camel caps, but expected convert_fields instead as per the coding standard.
Loading history...
1143
		$str = preg_replace('{sf:}', '', $any);
1144
1145
		$array = $this->xml2array('<Object xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">'.$str.'</Object>', 2);
1146
1147
		$xml = new stdClass();
1148
		if (!count($array['Object']))
0 ignored issues
show
Coding Style Best Practice introduced by
It is generally a best practice to always use braces with control structures.

Adding braces to control structures avoids accidental mistakes as your code changes:

// Without braces (not recommended)
if (true)
    doSomething();

// Recommended
if (true) {
    doSomething();
}
Loading history...
introduced by
Expected 1 space before "!"; 0 found
Loading history...
introduced by
Expected 1 space after "!"; 0 found
Loading history...
1149
			return $xml;
1150
1151
		foreach ($array['Object'] as $k=>$v) {
0 ignored issues
show
introduced by
No space after opening parenthesis is prohibited
Loading history...
introduced by
Expected 1 space before "=>"; 0 found
Loading history...
introduced by
Expected 1 space after "=>"; 0 found
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
1152
			$xml->$k = $v;
1153
		}
1154
1155
		//$new_string = '<Object xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">'.$new_string.'</Object>';
1156
		//$new_string = $new_string;
1157
		//$xml = simplexml_load_string($new_string);
1158
		return $xml;
1159
	}
1160
1161
	/**
1162
	 * 
1163
	 * @param string $contents
1164
	 * @return array
1165
	 */
1166
	function xml2array($contents, $get_attributes=1) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
introduced by
Expected 1 space between argument "$get_attributes" and equals sign; 0 found
Loading history...
introduced by
Expected 1 space between default value and equals sign for argument "$get_attributes";
Loading history...
1167
		if(!$contents) return array();
0 ignored issues
show
introduced by
Space after opening control structure is required
Loading history...
Coding Style Best Practice introduced by
It is generally a best practice to always use braces with control structures.

Adding braces to control structures avoids accidental mistakes as your code changes:

// Without braces (not recommended)
if (true)
    doSomething();

// Recommended
if (true) {
    doSomething();
}
Loading history...
introduced by
Expected 1 space before "!"; 0 found
Loading history...
introduced by
Expected 1 space after "!"; 0 found
Loading history...
1168
1169
		if(!function_exists('xml_parser_create')) {
0 ignored issues
show
introduced by
Space after opening control structure is required
Loading history...
introduced by
No space before opening parenthesis is prohibited
Loading history...
introduced by
No space after opening parenthesis is prohibited
Loading history...
introduced by
Expected 1 space before "!"; 0 found
Loading history...
introduced by
Expected 1 space after "!"; 0 found
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
1170
			//print "'xml_parser_create()' function not found!";
1171
			return array('not found');
0 ignored issues
show
introduced by
No space after opening parenthesis of array is bad style
Loading history...
introduced by
No space before closing parenthesis of array is bad style
Loading history...
1172
		}
1173
		//Get the XML parser of PHP - PHP must have this module for the parser to work
1174
		$parser = xml_parser_create();
1175
		xml_parser_set_option( $parser, XML_OPTION_CASE_FOLDING, 0 );
1176
		xml_parser_set_option( $parser, XML_OPTION_SKIP_WHITE, 1 );
1177
		xml_parse_into_struct( $parser, $contents, $xml_values );
1178
		xml_parser_free( $parser );
1179
1180
		if(!$xml_values) return;//Hmm...
0 ignored issues
show
Bug Best Practice introduced by
The expression $xml_values of type array is implicitly converted to a boolean; are you sure this is intended? If so, consider using empty($expr) instead to make it clear that you intend to check for an array without elements.

This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.

Consider making the comparison explicit by using empty(..) or ! empty(...) instead.

Loading history...
introduced by
Space after opening control structure is required
Loading history...
Coding Style Best Practice introduced by
It is generally a best practice to always use braces with control structures.

Adding braces to control structures avoids accidental mistakes as your code changes:

// Without braces (not recommended)
if (true)
    doSomething();

// Recommended
if (true) {
    doSomething();
}
Loading history...
introduced by
Expected 1 space before "!"; 0 found
Loading history...
introduced by
Expected 1 space after "!"; 0 found
Loading history...
1181
1182
		//Initializations
1183
		$xml_array = array();
1184
		$parents = array();
0 ignored issues
show
Unused Code introduced by
$parents is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
1185
		$opened_tags = array();
0 ignored issues
show
Unused Code introduced by
$opened_tags is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
1186
		$arr = array();
0 ignored issues
show
Unused Code introduced by
$arr is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
1187
1188
		$current = &$xml_array;
1189
1190
		//Go through the tags.
1191
		foreach($xml_values as $data) {
0 ignored issues
show
introduced by
Space after opening control structure is required
Loading history...
introduced by
No space before opening parenthesis is prohibited
Loading history...
introduced by
No space after opening parenthesis is prohibited
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
1192
			unset($attributes,$value);//Remove existing values, or there will be trouble
1193
1194
			//This command will extract these variables into the foreach scope
1195
			// tag(string), type(string), level(int), attributes(array).
1196
			extract($data);//We could use the array by itself, but this cooler.
0 ignored issues
show
introduced by
extract() usage is highly discouraged, due to the complexity and unintended issues it might cause.
Loading history...
1197
1198
			$result = '';
1199
			if ($get_attributes) {
0 ignored issues
show
introduced by
No space after opening parenthesis is prohibited
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
1200
				switch ($get_attributes) {
0 ignored issues
show
introduced by
No space after opening parenthesis is prohibited
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
1201
					case 1:
1202
						$result = array();
1203
						if(isset($value)) $result['value'] = $value;
0 ignored issues
show
introduced by
Space after opening control structure is required
Loading history...
Coding Style Best Practice introduced by
It is generally a best practice to always use braces with control structures.

Adding braces to control structures avoids accidental mistakes as your code changes:

// Without braces (not recommended)
if (true)
    doSomething();

// Recommended
if (true) {
    doSomething();
}
Loading history...
1204
1205
						//Set the attributes too.
1206
						if(isset($attributes)) {
0 ignored issues
show
introduced by
Space after opening control structure is required
Loading history...
introduced by
No space before opening parenthesis is prohibited
Loading history...
introduced by
No space after opening parenthesis is prohibited
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
1207
							foreach($attributes as $attr => $val) {
0 ignored issues
show
introduced by
Space after opening control structure is required
Loading history...
introduced by
No space before opening parenthesis is prohibited
Loading history...
introduced by
No space after opening parenthesis is prohibited
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
1208
								if($get_attributes == 1) $result['attr'][$attr] = $val; //Set all the attributes in a array called 'attr'
0 ignored issues
show
introduced by
Space after opening control structure is required
Loading history...
introduced by
Found "== 1". Use Yoda Condition checks, you must
Loading history...
Coding Style Best Practice introduced by
It is generally a best practice to always use braces with control structures.

Adding braces to control structures avoids accidental mistakes as your code changes:

// Without braces (not recommended)
if (true)
    doSomething();

// Recommended
if (true) {
    doSomething();
}
Loading history...
introduced by
Array keys should be surrounded by spaces unless they contain a string or an integer.
Loading history...
1209
								/**  :TODO: should we change the key name to '_attr'? Someone may use the tagname 'attr'. Same goes for 'value' too */
1210
							}
1211
						}
1212
						break;
1213
1214
					case 2:
1215
						$result = array();
1216
						if (isset($value)) {
0 ignored issues
show
introduced by
No space after opening parenthesis is prohibited
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
1217
							$result = $value;
1218
						}
1219
1220
						//Check for nil and ignore other attributes.
1221
						if (isset($attributes) && isset($attributes['xsi:nil']) && !strcasecmp($attributes['xsi:nil'], 'true')) {
0 ignored issues
show
introduced by
No space after opening parenthesis is prohibited
Loading history...
introduced by
Expected 1 space after "!"; 0 found
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
1222
							$result = null;
1223
						}
1224
						break;
1225
				}
1226
			} elseif (isset($value)) {
0 ignored issues
show
introduced by
No space after opening parenthesis is prohibited
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
1227
				$result = $value;
1228
			}
1229
1230
			//See tag status and do the needed.
1231
			if($type == "open") {//The starting of the tag '<tag>'
0 ignored issues
show
introduced by
Space after opening control structure is required
Loading history...
introduced by
No space before opening parenthesis is prohibited
Loading history...
introduced by
No space after opening parenthesis is prohibited
Loading history...
introduced by
Found "== "". Use Yoda Condition checks, you must
Loading history...
Coding Style Comprehensibility introduced by
The string literal open does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
1232
				$parent[$level-1] = &$current;
0 ignored issues
show
introduced by
Array keys should be surrounded by spaces unless they contain a string or an integer.
Loading history...
introduced by
Expected 1 space before "-"; 0 found
Loading history...
1233
1234
				if(!is_array($current) or (!in_array($tag, array_keys($current)))) { //Insert New tag
0 ignored issues
show
introduced by
Space after opening control structure is required
Loading history...
introduced by
No space before opening parenthesis is prohibited
Loading history...
introduced by
No space after opening parenthesis is prohibited
Loading history...
introduced by
Expected 1 space before "!"; 0 found
Loading history...
introduced by
Expected 1 space after "!"; 0 found
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
1235
					$current[$tag] = $result;
0 ignored issues
show
introduced by
Array keys should be surrounded by spaces unless they contain a string or an integer.
Loading history...
1236
					$current = &$current[$tag];
0 ignored issues
show
introduced by
Array keys should be surrounded by spaces unless they contain a string or an integer.
Loading history...
1237
1238
				} else { //There was another element with the same tag name
1239
					if(isset($current[$tag][0])) {
0 ignored issues
show
introduced by
Space after opening control structure is required
Loading history...
introduced by
No space before opening parenthesis is prohibited
Loading history...
introduced by
No space after opening parenthesis is prohibited
Loading history...
introduced by
Array keys should be surrounded by spaces unless they contain a string or an integer.
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
1240
						array_push($current[$tag], $result);
0 ignored issues
show
introduced by
Array keys should be surrounded by spaces unless they contain a string or an integer.
Loading history...
1241
					} else {
1242
						$current[$tag] = array($current[$tag],$result);
0 ignored issues
show
introduced by
Array keys should be surrounded by spaces unless they contain a string or an integer.
Loading history...
introduced by
No space after opening parenthesis of array is bad style
Loading history...
introduced by
Expected 1 space between comma and "$result"; 0 found
Loading history...
introduced by
No space before closing parenthesis of array is bad style
Loading history...
1243
					}
1244
					$last = count($current[$tag]) - 1;
0 ignored issues
show
introduced by
Array keys should be surrounded by spaces unless they contain a string or an integer.
Loading history...
1245
					$current = &$current[$tag][$last];
0 ignored issues
show
introduced by
Array keys should be surrounded by spaces unless they contain a string or an integer.
Loading history...
1246
				}
0 ignored issues
show
introduced by
Blank line found after control structure
Loading history...
1247
1248
			} elseif($type == "complete") { //Tags that ends in 1 line '<tag />'
0 ignored issues
show
introduced by
Space after opening control structure is required
Loading history...
introduced by
No space before opening parenthesis is prohibited
Loading history...
introduced by
No space after opening parenthesis is prohibited
Loading history...
introduced by
Found "== "". Use Yoda Condition checks, you must
Loading history...
Coding Style Comprehensibility introduced by
The string literal complete does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
1249
				//See if the key is already taken.
1250
				if(!isset($current[$tag])) { //New Key
0 ignored issues
show
introduced by
Space after opening control structure is required
Loading history...
introduced by
No space before opening parenthesis is prohibited
Loading history...
introduced by
No space after opening parenthesis is prohibited
Loading history...
introduced by
Expected 1 space before "!"; 0 found
Loading history...
introduced by
Expected 1 space after "!"; 0 found
Loading history...
introduced by
Array keys should be surrounded by spaces unless they contain a string or an integer.
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
1251
					$current[$tag] = $result;
0 ignored issues
show
introduced by
Array keys should be surrounded by spaces unless they contain a string or an integer.
Loading history...
1252
1253
				} else { //If taken, put all things inside a list(array)
1254
					if((is_array($current[$tag]) and $get_attributes == 0)//If it is already an array...
0 ignored issues
show
introduced by
Space after opening control structure is required
Loading history...
introduced by
No space before opening parenthesis is prohibited
Loading history...
introduced by
No space after opening parenthesis is prohibited
Loading history...
introduced by
Found "== 0". Use Yoda Condition checks, you must
Loading history...
introduced by
Found "== 1". Use Yoda Condition checks, you must
Loading history...
introduced by
Found "== 2". Use Yoda Condition checks, you must
Loading history...
introduced by
Array keys should be surrounded by spaces unless they contain a string or an integer.
Loading history...
1255
							or (isset($current[$tag][0]) and is_array($current[$tag][0]) and ($get_attributes == 1 || $get_attributes == 2))) {
0 ignored issues
show
introduced by
Array keys should be surrounded by spaces unless they contain a string or an integer.
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
1256
						array_push($current[$tag],$result); // ...push the new element into that array.
0 ignored issues
show
introduced by
Array keys should be surrounded by spaces unless they contain a string or an integer.
Loading history...
1257
					} else { //If it is not an array...
1258
						$current[$tag] = array($current[$tag],$result); //...Make it an array using using the existing value and the new value
0 ignored issues
show
introduced by
Array keys should be surrounded by spaces unless they contain a string or an integer.
Loading history...
introduced by
No space after opening parenthesis of array is bad style
Loading history...
introduced by
Expected 1 space between comma and "$result"; 0 found
Loading history...
introduced by
No space before closing parenthesis of array is bad style
Loading history...
1259
					}
1260
				}
0 ignored issues
show
introduced by
Blank line found after control structure
Loading history...
1261
1262
			} elseif($type == 'close') { //End of tag '</tag>'
0 ignored issues
show
introduced by
Space after opening control structure is required
Loading history...
introduced by
No space before opening parenthesis is prohibited
Loading history...
introduced by
No space after opening parenthesis is prohibited
Loading history...
introduced by
Found "== '". Use Yoda Condition checks, you must
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
1263
				$current = &$parent[$level-1];
0 ignored issues
show
introduced by
Array keys should be surrounded by spaces unless they contain a string or an integer.
Loading history...
introduced by
Expected 1 space before "-"; 0 found
Loading history...
1264
			}
1265
		}
1266
1267
		return($xml_array);
1268
	}
1269
1270
	/*
1271
	 * If the stdClass has a done, we know it is a QueryResult
1272
	 */
1273
	function isQueryResult($param) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
Coding Style introduced by
The function name isQueryResult is in camel caps, but expected is_query_result instead as per the coding standard.
Loading history...
1274
		return isset($param->done);
1275
	}
1276
1277
	/*
1278
	 * If the stdClass has a type, we know it is an SObject
1279
	 */
1280
	function isSObject($param) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
Coding Style introduced by
The function name isSObject is in camel caps, but expected is_s_object instead as per the coding standard.
Loading history...
1281
		return isset($param->type);
1282
	}
1283
}
1284