@@ -9,7 +9,7 @@ |
||
9 | 9 | { |
10 | 10 | public function register() |
11 | 11 | { |
12 | - $this->app->singleton('salesforce', function () { |
|
12 | + $this->app->singleton('salesforce', function() { |
|
13 | 13 | $authClient = new Client([ |
14 | 14 | 'headers' => [ |
15 | 15 | 'Accept' => 'application/json', |
@@ -83,7 +83,7 @@ |
||
83 | 83 | $this->id = $responseObject->id; |
84 | 84 | $this->accessToken = $responseObject->access_token; |
85 | 85 | $this->instanceUrl = $responseObject->instance_url; |
86 | - $this->url = $responseObject->instance_url . $this->version['url']; |
|
86 | + $this->url = $responseObject->instance_url.$this->version['url']; |
|
87 | 87 | |
88 | 88 | if ($this->accessToken !== null) { |
89 | 89 | $this->authenticated = true; |
@@ -128,7 +128,7 @@ |
||
128 | 128 | /** |
129 | 129 | * Run Salesforce query. |
130 | 130 | * |
131 | - * @param $query |
|
131 | + * @param string $query |
|
132 | 132 | * |
133 | 133 | * @return mixed |
134 | 134 | */ |
@@ -36,11 +36,11 @@ discard block |
||
36 | 36 | ])); |
37 | 37 | |
38 | 38 | if (config('laravel-salesforce.disable_on_local') && app()->environment('local')) { |
39 | - $response = (object)['success' => true, 'totalSize' => 0, 'id' => 'localRequestId', 'OwnerId' => 'localRequestId']; |
|
39 | + $response = (object) ['success' => true, 'totalSize' => 0, 'id' => 'localRequestId', 'OwnerId' => 'localRequestId']; |
|
40 | 40 | } else { |
41 | 41 | try { |
42 | 42 | $response = json_decode( |
43 | - $this->salesforce->client->request($method, $this->salesforce->baseUrl . $url, $options) |
|
43 | + $this->salesforce->client->request($method, $this->salesforce->baseUrl.$url, $options) |
|
44 | 44 | ->getBody()); |
45 | 45 | } catch (ClientException $e) { |
46 | 46 | throw new SalesforceException($e->getMessage()); |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | } |
65 | 65 | |
66 | 66 | if ($this->custom === true) { |
67 | - return (new \ReflectionClass($this))->getShortName() . '__c'; |
|
67 | + return (new \ReflectionClass($this))->getShortName().'__c'; |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | return (new \ReflectionClass($this))->getShortName(); |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | */ |
78 | 78 | public function getVersion() |
79 | 79 | { |
80 | - return $this->sendRequest('GET', $this->salesforce->instanceUrl . '/services/data'); |
|
80 | + return $this->sendRequest('GET', $this->salesforce->instanceUrl.'/services/data'); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | /** |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | */ |
86 | 86 | public function listOrganisationLimits() |
87 | 87 | { |
88 | - return $this->sendRequest('GET', $this->salesforce->instanceUrl . $this->version['url'] . '/limits'); |
|
88 | + return $this->sendRequest('GET', $this->salesforce->instanceUrl.$this->version['url'].'/limits'); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | /** |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | */ |
118 | 118 | public function describeObject($objectName) |
119 | 119 | { |
120 | - return $this->sendRequest('GET', '/sobjects/' . $objectName . '/describe'); |
|
120 | + return $this->sendRequest('GET', '/sobjects/'.$objectName.'/describe'); |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | /** |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | */ |
130 | 130 | public function describeBasicObject($objectName) |
131 | 131 | { |
132 | - return $this->sendRequest('GET', '/sobjects/' . $objectName); |
|
132 | + return $this->sendRequest('GET', '/sobjects/'.$objectName); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | /** |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | */ |
158 | 158 | public function get(string $id, array $fields = []) |
159 | 159 | { |
160 | - return $this->sendRequest('GET', "/sobjects/" . $this->getType() . "/$id", ['query' => $fields]); |
|
160 | + return $this->sendRequest('GET', "/sobjects/".$this->getType()."/$id", ['query' => $fields]); |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | /** |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | */ |
170 | 170 | public function update(string $id, array $params) |
171 | 171 | { |
172 | - $this->sendRequest('PATCH', "/sobjects/" . $this->getType() . "/$id", |
|
172 | + $this->sendRequest('PATCH', "/sobjects/".$this->getType()."/$id", |
|
173 | 173 | [ |
174 | 174 | 'json' => $params, |
175 | 175 | ] |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | */ |
186 | 186 | public function create(array $params) |
187 | 187 | { |
188 | - $response = $this->sendRequest('POST', "/sobjects/" . $this->getType(), [ |
|
188 | + $response = $this->sendRequest('POST', "/sobjects/".$this->getType(), [ |
|
189 | 189 | 'json' => $params, |
190 | 190 | ]); |
191 | 191 | |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | */ |
205 | 205 | public function delete(string $id) |
206 | 206 | { |
207 | - $this->sendRequest('DELETE', "/sobjects/" . $this->getType() . "/$id"); |
|
207 | + $this->sendRequest('DELETE', "/sobjects/".$this->getType()."/$id"); |
|
208 | 208 | } |
209 | 209 | |
210 | 210 | /** |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | { |
219 | 219 | return $this->sendRequest( |
220 | 220 | 'GET', |
221 | - '/analytics/reports/' . $id, |
|
221 | + '/analytics/reports/'.$id, |
|
222 | 222 | ['query' => ['hasDetailRows' => $includeDetails]] |
223 | 223 | ); |
224 | 224 | } |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | /** |
68 | 68 | * Create object dynamically |
69 | 69 | * |
70 | - * @param $method |
|
70 | + * @param string $method |
|
71 | 71 | * @param $args |
72 | 72 | * @return bool |
73 | 73 | */ |
@@ -83,6 +83,9 @@ discard block |
||
83 | 83 | return (new BaseObject($this, $type))->create($args[0]); |
84 | 84 | } |
85 | 85 | |
86 | + /** |
|
87 | + * @param string $method |
|
88 | + */ |
|
86 | 89 | private function callUpdateOnObject($method, $args) |
87 | 90 | { |
88 | 91 | $type = substr($method, 6); |
@@ -95,6 +98,9 @@ discard block |
||
95 | 98 | return (new BaseObject($this, $type))->update($type, $args[0]); |
96 | 99 | } |
97 | 100 | |
101 | + /** |
|
102 | + * @param string $method |
|
103 | + */ |
|
98 | 104 | private function callDeleteOnObject($method, $args) |
99 | 105 | { |
100 | 106 | $type = substr($method, 6); |
@@ -107,6 +113,9 @@ discard block |
||
107 | 113 | return (new BaseObject($this, $type))->delete($args[0]); |
108 | 114 | } |
109 | 115 | |
116 | + /** |
|
117 | + * @param string $method |
|
118 | + */ |
|
110 | 119 | private function callGetOnObject($method, $args) |
111 | 120 | { |
112 | 121 | $type = substr($method, 3); |
@@ -119,6 +128,9 @@ discard block |
||
119 | 128 | return (new BaseObject($this, $type))->get($args[0]); |
120 | 129 | } |
121 | 130 | |
131 | + /** |
|
132 | + * @param string $method |
|
133 | + */ |
|
122 | 134 | private function callExistsOnObject($method, $args) |
123 | 135 | { |
124 | 136 | $type = substr($method, 6); |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | private function callCreateOnObject($method, $args) |
75 | 75 | { |
76 | 76 | $type = substr($method, 6); |
77 | - $class = '\\Surge\\LaravelSalesforce\\Objects\\' . $type; |
|
77 | + $class = '\\Surge\\LaravelSalesforce\\Objects\\'.$type; |
|
78 | 78 | |
79 | 79 | if (class_exists($class)) { |
80 | 80 | return (new $class($this))->create($args[0]); |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | private function callUpdateOnObject($method, $args) |
87 | 87 | { |
88 | 88 | $type = substr($method, 6); |
89 | - $class = '\\Surge\\LaravelSalesforce\\Objects\\' . $type; |
|
89 | + $class = '\\Surge\\LaravelSalesforce\\Objects\\'.$type; |
|
90 | 90 | |
91 | 91 | if (class_exists($class)) { |
92 | 92 | return (new $class($this))->update($args[0], $args[1]); |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | private function callDeleteOnObject($method, $args) |
99 | 99 | { |
100 | 100 | $type = substr($method, 6); |
101 | - $class = '\\Surge\\LaravelSalesforce\\Objects\\' . $type; |
|
101 | + $class = '\\Surge\\LaravelSalesforce\\Objects\\'.$type; |
|
102 | 102 | |
103 | 103 | if (class_exists($class)) { |
104 | 104 | return (new $class($this))->delete($args[0]); |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | private function callGetOnObject($method, $args) |
111 | 111 | { |
112 | 112 | $type = substr($method, 3); |
113 | - $class = '\\Surge\\LaravelSalesforce\\Objects\\' . $type; |
|
113 | + $class = '\\Surge\\LaravelSalesforce\\Objects\\'.$type; |
|
114 | 114 | |
115 | 115 | if (class_exists($class)) { |
116 | 116 | return (new $class($this))->get($args[0]); |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | private function callExistsOnObject($method, $args) |
123 | 123 | { |
124 | 124 | $type = substr($method, 6); |
125 | - $class = '\\Surge\\LaravelSalesforce\\Objects\\' . $type; |
|
125 | + $class = '\\Surge\\LaravelSalesforce\\Objects\\'.$type; |
|
126 | 126 | |
127 | 127 | if (class_exists($class)) { |
128 | 128 | if (isset($args[1]) && isset($args[2])) { //second and third params are optional |
@@ -23,7 +23,7 @@ |
||
23 | 23 | * ] |
24 | 24 | * |
25 | 25 | * |
26 | - * @param array $param to search |
|
26 | + * @param array $params to search |
|
27 | 27 | * @param string $condition |
28 | 28 | * @return bool|array |
29 | 29 | */ |
@@ -33,14 +33,14 @@ |
||
33 | 33 | return false; |
34 | 34 | } |
35 | 35 | |
36 | - $query = 'SELECT Id, OwnerId, Salutation, FirstName, LastName FROM ' . $this->getType() . ' WHERE RecordTypeId = \'' . config('laravel-salesforce.record_type.account') . '\''; |
|
36 | + $query = 'SELECT Id, OwnerId, Salutation, FirstName, LastName FROM '.$this->getType().' WHERE RecordTypeId = \''.config('laravel-salesforce.record_type.account').'\''; |
|
37 | 37 | |
38 | 38 | $paramsWithKeys = []; |
39 | 39 | foreach ($params as $fieldName => $fieldValue) { |
40 | - $paramsWithKeys[] = $fieldName . ' = \'' . addslashes(trim($fieldValue)) . '\''; |
|
40 | + $paramsWithKeys[] = $fieldName.' = \''.addslashes(trim($fieldValue)).'\''; |
|
41 | 41 | } |
42 | 42 | |
43 | - $query .= ' AND (' . implode(' ' . $condition . ' ', $paramsWithKeys) . ')'; |
|
43 | + $query .= ' AND ('.implode(' '.$condition.' ', $paramsWithKeys).')'; |
|
44 | 44 | |
45 | 45 | $response = $this->query($query); |
46 | 46 |
@@ -35,14 +35,14 @@ |
||
35 | 35 | return false; |
36 | 36 | } |
37 | 37 | |
38 | - $query = 'SELECT Id, OwnerId FROM ' . $this->getType() . ' WHERE RecordTypeId = \'' . config('laravel-salesforce.record_type.lead') . '\''; |
|
38 | + $query = 'SELECT Id, OwnerId FROM '.$this->getType().' WHERE RecordTypeId = \''.config('laravel-salesforce.record_type.lead').'\''; |
|
39 | 39 | |
40 | 40 | $paramsWithKeys = []; |
41 | 41 | foreach ($params as $fieldName => $fieldValue) { |
42 | - $paramsWithKeys[] = $fieldName . ' = \'' . addslashes(trim($fieldValue)) . '\''; |
|
42 | + $paramsWithKeys[] = $fieldName.' = \''.addslashes(trim($fieldValue)).'\''; |
|
43 | 43 | } |
44 | 44 | |
45 | - $query .= ' AND (' . implode(' ' . $condition . ' ', $paramsWithKeys) . ')'; |
|
45 | + $query .= ' AND ('.implode(' '.$condition.' ', $paramsWithKeys).')'; |
|
46 | 46 | |
47 | 47 | $response = $this->query($query); |
48 | 48 |
@@ -20,14 +20,14 @@ |
||
20 | 20 | return false; |
21 | 21 | } |
22 | 22 | |
23 | - $query = 'SELECT Id, Name, Email, UserType, UserRoleId FROM ' . $this->getType() . ' WHERE '; |
|
23 | + $query = 'SELECT Id, Name, Email, UserType, UserRoleId FROM '.$this->getType().' WHERE '; |
|
24 | 24 | |
25 | 25 | $paramsWithKeys = []; |
26 | 26 | foreach ($params as $fieldName => $fieldValue) { |
27 | - $paramsWithKeys[] = $fieldName . ' = \'' . addslashes(trim($fieldValue)) . '\''; |
|
27 | + $paramsWithKeys[] = $fieldName.' = \''.addslashes(trim($fieldValue)).'\''; |
|
28 | 28 | } |
29 | 29 | |
30 | - $query .= '(' . implode(' ' . $condition . ' ', $paramsWithKeys) . ')'; |
|
30 | + $query .= '('.implode(' '.$condition.' ', $paramsWithKeys).')'; |
|
31 | 31 | |
32 | 32 | $response = $this->query($query); |
33 | 33 |
@@ -27,14 +27,14 @@ |
||
27 | 27 | return false; |
28 | 28 | } |
29 | 29 | |
30 | - $query = 'SELECT Id, Paid__c FROM ' . $this->getType() . ' WHERE '; |
|
30 | + $query = 'SELECT Id, Paid__c FROM '.$this->getType().' WHERE '; |
|
31 | 31 | |
32 | 32 | $paramsWithKeys = []; |
33 | 33 | foreach ($params as $fieldName => $fieldValue) { |
34 | - $paramsWithKeys[] = $fieldName . ' = \'' . addslashes(trim($fieldValue)) . '\''; |
|
34 | + $paramsWithKeys[] = $fieldName.' = \''.addslashes(trim($fieldValue)).'\''; |
|
35 | 35 | } |
36 | 36 | |
37 | - $query .= '(' . implode(' ' . $condition . ' ', $paramsWithKeys) . ')'; |
|
37 | + $query .= '('.implode(' '.$condition.' ', $paramsWithKeys).')'; |
|
38 | 38 | |
39 | 39 | $response = $this->query($query); |
40 | 40 |