@@ -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 | */ |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | |
| 36 | 36 | try { |
| 37 | 37 | $response = json_decode( |
| 38 | - $this->salesforce->client->request($method, $this->salesforce->baseUrl . $url, $options) |
|
| 38 | + $this->salesforce->client->request($method, $this->salesforce->baseUrl.$url, $options) |
|
| 39 | 39 | ->getBody()); |
| 40 | 40 | } catch (ClientException $e) { |
| 41 | 41 | throw new SalesforceException($e->getMessage()); |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | */ |
| 69 | 69 | public function getVersion() |
| 70 | 70 | { |
| 71 | - return $this->sendRequest('GET', $this->salesforce->instanceUrl . '/services/data'); |
|
| 71 | + return $this->sendRequest('GET', $this->salesforce->instanceUrl.'/services/data'); |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | /** |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | */ |
| 77 | 77 | public function listOrganisationLimits() |
| 78 | 78 | { |
| 79 | - return $this->sendRequest('GET', $this->salesforce->instanceUrl . $this->version['url'] . '/limits'); |
|
| 79 | + return $this->sendRequest('GET', $this->salesforce->instanceUrl.$this->version['url'].'/limits'); |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | /** |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | */ |
| 109 | 109 | public function describeObject($objectName) |
| 110 | 110 | { |
| 111 | - return $this->sendRequest('GET', '/sobjects/' . $objectName . '/describe'); |
|
| 111 | + return $this->sendRequest('GET', '/sobjects/'.$objectName.'/describe'); |
|
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | /** |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | */ |
| 121 | 121 | public function describeBasicObject($objectName) |
| 122 | 122 | { |
| 123 | - return $this->sendRequest('GET', '/sobjects/' . $objectName); |
|
| 123 | + return $this->sendRequest('GET', '/sobjects/'.$objectName); |
|
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | /** |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | */ |
| 149 | 149 | public function get(string $id, array $fields = []) |
| 150 | 150 | { |
| 151 | - return $this->sendRequest('GET', "/sobjects/" . $this->getType() . "/$id", ['query' => $fields]); |
|
| 151 | + return $this->sendRequest('GET', "/sobjects/".$this->getType()."/$id", ['query' => $fields]); |
|
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | /** |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | */ |
| 161 | 161 | public function update(string $id, array $params) |
| 162 | 162 | { |
| 163 | - $this->sendRequest('PATCH', "/sobjects/" . $this->getType() . "/$id", |
|
| 163 | + $this->sendRequest('PATCH', "/sobjects/".$this->getType()."/$id", |
|
| 164 | 164 | [ |
| 165 | 165 | 'json' => $params, |
| 166 | 166 | ] |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | */ |
| 177 | 177 | public function create(array $params) |
| 178 | 178 | { |
| 179 | - $response = $this->sendRequest('POST', "/sobjects/" . $this->getType(), [ |
|
| 179 | + $response = $this->sendRequest('POST', "/sobjects/".$this->getType(), [ |
|
| 180 | 180 | 'json' => $params, |
| 181 | 181 | ]); |
| 182 | 182 | |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | */ |
| 196 | 196 | public function delete(string $id) |
| 197 | 197 | { |
| 198 | - $response = $this->sendRequest('DELETE', "/sobjects/" . $this->getType() . "/$id"); |
|
| 198 | + $response = $this->sendRequest('DELETE', "/sobjects/".$this->getType()."/$id"); |
|
| 199 | 199 | |
| 200 | 200 | if ($response->success !== true) { |
| 201 | 201 | throw new SalesforceException($response->errors); |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | { |
| 209 | 209 | return $this->sendRequest( |
| 210 | 210 | 'GET', |
| 211 | - '/analytics/reports/' . $id, |
|
| 211 | + '/analytics/reports/'.$id, |
|
| 212 | 212 | ['query' => ['includeDetails' => $includeDetails]] |
| 213 | 213 | ); |
| 214 | 214 | } |
@@ -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 | return (new $class($this))->exists($args[0]); |
@@ -23,7 +23,7 @@ |
||
| 23 | 23 | * ] |
| 24 | 24 | * |
| 25 | 25 | * |
| 26 | - * @param array $param to search |
|
| 26 | + * @param array $params to search |
|
| 27 | 27 | * @return bool|array |
| 28 | 28 | */ |
| 29 | 29 | public function exists($params) |
@@ -32,10 +32,10 @@ |
||
| 32 | 32 | return false; |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | - $query = 'SELECT Id, OwnerId FROM ' . $this->getType() . ' WHERE RecordTypeId = \'' . config('laravel-salesforce.record_type.account') . '\''; |
|
| 35 | + $query = 'SELECT Id, OwnerId FROM '.$this->getType().' WHERE RecordTypeId = \''.config('laravel-salesforce.record_type.account').'\''; |
|
| 36 | 36 | |
| 37 | 37 | foreach ($params as $fieldName => $fieldValue) { |
| 38 | - $query .= ' AND ' . $fieldName . '=\'' . addslashes(trim($fieldValue)) . '\''; |
|
| 38 | + $query .= ' AND '.$fieldName.'=\''.addslashes(trim($fieldValue)).'\''; |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | $response = $this->query($query); |
@@ -34,10 +34,10 @@ |
||
| 34 | 34 | return false; |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | - $query = 'SELECT Id, OwnerId FROM ' . $this->getType() . ' AND RecordTypeId = \'' . config('laravel-salesforce.record_type.lead') . '\''; |
|
| 37 | + $query = 'SELECT Id, OwnerId FROM '.$this->getType().' AND RecordTypeId = \''.config('laravel-salesforce.record_type.lead').'\''; |
|
| 38 | 38 | |
| 39 | 39 | foreach ($params as $fieldName => $fieldValue) { |
| 40 | - $query .= ' AND ' . $fieldName . '=\'' . addslashes(trim($fieldValue)) . '\''; |
|
| 40 | + $query .= ' AND '.$fieldName.'=\''.addslashes(trim($fieldValue)).'\''; |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | $response = $this->query($query); |