| @@ -2,7 +2,6 @@ | ||
| 2 | 2 | |
| 3 | 3 | namespace Surge\LaravelSalesforce; | 
| 4 | 4 | |
| 5 | -use Event; | |
| 6 | 5 | use Surge\LaravelSalesforce\Objects\BaseObject; | 
| 7 | 6 | |
| 8 | 7 | class Salesforce | 
| @@ -65,7 +65,7 @@ discard block | ||
| 65 | 65 | private function callCreateOnObject($method, $args) | 
| 66 | 66 |      { | 
| 67 | 67 | $type = substr($method, 6); | 
| 68 | - $class = '\\Surge\\LaravelSalesforce\\Objects\\' . $type; | |
| 68 | + $class = '\\Surge\\LaravelSalesforce\\Objects\\'.$type; | |
| 69 | 69 | |
| 70 | 70 |          if (class_exists($class)) { | 
| 71 | 71 | return (new $class())->create($args[0]); | 
| @@ -77,7 +77,7 @@ discard block | ||
| 77 | 77 | private function callUpdateOnObject($method, $args) | 
| 78 | 78 |      { | 
| 79 | 79 | $type = substr($method, 6); | 
| 80 | - $class = '\\Surge\\LaravelSalesforce\\Objects\\' . $type; | |
| 80 | + $class = '\\Surge\\LaravelSalesforce\\Objects\\'.$type; | |
| 81 | 81 | |
| 82 | 82 |          if (class_exists($class)) { | 
| 83 | 83 | return (new $class())->update($args[0]); | 
| @@ -89,7 +89,7 @@ discard block | ||
| 89 | 89 | private function callDeleteOnObject($method, $args) | 
| 90 | 90 |      { | 
| 91 | 91 | $type = substr($method, 6); | 
| 92 | - $class = '\\Surge\\LaravelSalesforce\\Objects\\' . $type; | |
| 92 | + $class = '\\Surge\\LaravelSalesforce\\Objects\\'.$type; | |
| 93 | 93 | |
| 94 | 94 |          if (class_exists($class)) { | 
| 95 | 95 | return (new $class())->delete($args[0]); | 
| @@ -101,7 +101,7 @@ discard block | ||
| 101 | 101 | private function callGetOnObject($method, $args) | 
| 102 | 102 |      { | 
| 103 | 103 | $type = substr($method, 3); | 
| 104 | - $class = '\\Surge\\LaravelSalesforce\\Objects\\' . $type; | |
| 104 | + $class = '\\Surge\\LaravelSalesforce\\Objects\\'.$type; | |
| 105 | 105 | |
| 106 | 106 |          if (class_exists($class)) { | 
| 107 | 107 | return (new $class())->get($args[0]); | 
| @@ -20,7 +20,7 @@ discard block | ||
| 20 | 20 | /** | 
| 21 | 21 | * Salesforce constructor. | 
| 22 | 22 | * | 
| 23 | - * @param $client | |
| 23 | + * @param \GuzzleHttp\Client $client | |
| 24 | 24 | * @param SalesforceAuth $auth | 
| 25 | 25 | */ | 
| 26 | 26 | public function __construct($client, SalesforceAuth $auth) | 
| @@ -60,7 +60,7 @@ discard block | ||
| 60 | 60 | /** | 
| 61 | 61 | * Create object dynamically | 
| 62 | 62 | * | 
| 63 | - * @param $method | |
| 63 | + * @param string $method | |
| 64 | 64 | * @param $args | 
| 65 | 65 | * @return bool | 
| 66 | 66 | */ | 
| @@ -76,6 +76,9 @@ discard block | ||
| 76 | 76 | return (new BaseObject($type))->create($args[0]); | 
| 77 | 77 | } | 
| 78 | 78 | |
| 79 | + /** | |
| 80 | + * @param string $method | |
| 81 | + */ | |
| 79 | 82 | private function callUpdateOnObject($method, $args) | 
| 80 | 83 |      { | 
| 81 | 84 | $type = substr($method, 6); | 
| @@ -88,6 +91,9 @@ discard block | ||
| 88 | 91 | return (new BaseObject($type))->update($type, $args[0]); | 
| 89 | 92 | } | 
| 90 | 93 | |
| 94 | + /** | |
| 95 | + * @param string $method | |
| 96 | + */ | |
| 91 | 97 | private function callDeleteOnObject($method, $args) | 
| 92 | 98 |      { | 
| 93 | 99 | $type = substr($method, 6); | 
| @@ -100,6 +106,9 @@ discard block | ||
| 100 | 106 | return (new BaseObject($type))->delete($type, $args[0]); | 
| 101 | 107 | } | 
| 102 | 108 | |
| 109 | + /** | |
| 110 | + * @param string $method | |
| 111 | + */ | |
| 103 | 112 | private function callGetOnObject($method, $args) | 
| 104 | 113 |      { | 
| 105 | 114 | $type = substr($method, 3); | 
| @@ -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', | 
| @@ -42,7 +42,7 @@ | ||
| 42 | 42 | /** | 
| 43 | 43 | * SalesforceAuth constructor. | 
| 44 | 44 | * | 
| 45 | - * @param $client | |
| 45 | + * @param \GuzzleHttp\Client $client | |
| 46 | 46 | */ | 
| 47 | 47 | public function __construct($client) | 
| 48 | 48 |      { | 
| @@ -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; | 
| @@ -42,7 +42,7 @@ discard block | ||
| 42 | 42 | /** | 
| 43 | 43 | * Get latest version. | 
| 44 | 44 | * | 
| 45 | - * @return mixed | |
| 45 | + * @return string | |
| 46 | 46 | */ | 
| 47 | 47 | protected function getVersion() | 
| 48 | 48 |      { | 
| @@ -60,7 +60,7 @@ discard block | ||
| 60 | 60 | /** | 
| 61 | 61 | * List all available resources. | 
| 62 | 62 | * | 
| 63 | - * @return mixed | |
| 63 | + * @return string | |
| 64 | 64 | */ | 
| 65 | 65 | protected function listAvailableResources() | 
| 66 | 66 |      { | 
| @@ -70,7 +70,7 @@ discard block | ||
| 70 | 70 | /** | 
| 71 | 71 | * List all objects. | 
| 72 | 72 | * | 
| 73 | - * @return mixed | |
| 73 | + * @return string | |
| 74 | 74 | */ | 
| 75 | 75 | protected function listObjects() | 
| 76 | 76 |      { | 
| @@ -82,7 +82,7 @@ discard block | ||
| 82 | 82 | * | 
| 83 | 83 | * @param $objectName | 
| 84 | 84 | * | 
| 85 | - * @return mixed | |
| 85 | + * @return string | |
| 86 | 86 | */ | 
| 87 | 87 | protected function describeObject($objectName) | 
| 88 | 88 |      { | 
| @@ -94,7 +94,7 @@ discard block | ||
| 94 | 94 | * | 
| 95 | 95 | * @param $objectName | 
| 96 | 96 | * | 
| 97 | - * @return mixed | |
| 97 | + * @return string | |
| 98 | 98 | */ | 
| 99 | 99 | protected function describeBasicObject($objectName) | 
| 100 | 100 |      { | 
| @@ -106,7 +106,7 @@ discard block | ||
| 106 | 106 | * | 
| 107 | 107 | * @param string $id | 
| 108 | 108 | * @param bool $includeDetails | 
| 109 | - * @return mixed | |
| 109 | + * @return string | |
| 110 | 110 | * | 
| 111 | 111 | */ | 
| 112 | 112 | public function runReport(string $id, bool $includeDetails) | 
| @@ -121,9 +121,9 @@ discard block | ||
| 121 | 121 | /** | 
| 122 | 122 | * Run Salesforce query. | 
| 123 | 123 | * | 
| 124 | - * @param $query | |
| 124 | + * @param string $query | |
| 125 | 125 | * | 
| 126 | - * @return mixed | |
| 126 | + * @return string | |
| 127 | 127 | */ | 
| 128 | 128 | protected function query($query) | 
| 129 | 129 |      { | 
| @@ -138,7 +138,7 @@ discard block | ||
| 138 | 138 | * @param string $id | 
| 139 | 139 | * | 
| 140 | 140 | * @param array $fields | 
| 141 | - * @return bool|mixed | |
| 141 | + * @return false|string | |
| 142 | 142 | */ | 
| 143 | 143 | public function get(string $id, array $fields = []) | 
| 144 | 144 |      { | 
| @@ -160,7 +160,7 @@ discard block | ||
| 160 | 160 | * | 
| 161 | 161 | * @param string $id | 
| 162 | 162 | * @param $params | 
| 163 | - * @return bool|mixed | |
| 163 | + * @return false|string | |
| 164 | 164 | * @throws SalesforceException | 
| 165 | 165 | */ | 
| 166 | 166 | public function update(string $id, array $params) | 
| @@ -193,7 +193,7 @@ discard block | ||
| 193 | 193 | * | 
| 194 | 194 | * @param $params | 
| 195 | 195 | * | 
| 196 | - * @return bool | |
| 196 | + * @return false|string | |
| 197 | 197 | * @throws SalesforceException | 
| 198 | 198 | */ | 
| 199 | 199 | public function create(array $params) | 
| @@ -217,7 +217,7 @@ discard block | ||
| 217 | 217 | * Delete a given record | 
| 218 | 218 | * | 
| 219 | 219 | * @param string $id | 
| 220 | - * @return bool | |
| 220 | + * @return false|string | |
| 221 | 221 | * @throws SalesforceException | 
| 222 | 222 | */ | 
| 223 | 223 | public function delete(string $id) | 
| @@ -113,7 +113,7 @@ discard block | ||
| 113 | 113 |      { | 
| 114 | 114 | return $this->sendRequest( | 
| 115 | 115 | 'GET', | 
| 116 | - '/analytics/reports/' . $id, | |
| 116 | + '/analytics/reports/'.$id, | |
| 117 | 117 | ['query' => ['includeDetails' => $includeDetails]] | 
| 118 | 118 | ); | 
| 119 | 119 | } | 
| @@ -146,7 +146,7 @@ discard block | ||
| 146 | 146 | return false; | 
| 147 | 147 | } | 
| 148 | 148 | |
| 149 | -        $response = $this->sendRequest('GET', "/sobjects/" . $this->getType() . "/$id", ['query' => $fields]); | |
| 149 | +        $response = $this->sendRequest('GET', "/sobjects/".$this->getType()."/$id", ['query' => $fields]); | |
| 150 | 150 | |
| 151 | 151 |          if (!$response) { | 
| 152 | 152 | return false; | 
| @@ -198,7 +198,7 @@ discard block | ||
| 198 | 198 | */ | 
| 199 | 199 | public function create(array $params) | 
| 200 | 200 |      { | 
| 201 | -        $response = $this->sendRequest('POST', "/sobject/" . $this->getType(), [ | |
| 201 | +        $response = $this->sendRequest('POST', "/sobject/".$this->getType(), [ | |
| 202 | 202 | 'json' => $params, | 
| 203 | 203 | ]); | 
| 204 | 204 | |
| @@ -222,7 +222,7 @@ discard block | ||
| 222 | 222 | */ | 
| 223 | 223 | public function delete(string $id) | 
| 224 | 224 |      { | 
| 225 | -        $response = $this->sendRequest('DELETE', "/sobjects/" . $this->getType() ."/$id"); | |
| 225 | +        $response = $this->sendRequest('DELETE', "/sobjects/".$this->getType()."/$id"); | |
| 226 | 226 | |
| 227 | 227 |          if (!$response) { | 
| 228 | 228 | return false; |