@@ -1,8 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | namespace SevenShores\Hubspot\Resources; |
| 3 | 3 | |
| 4 | -use SevenShores\Hubspot\Exceptions\HubspotException; |
|
| 5 | - |
|
| 6 | 4 | class Deals extends Resource |
| 7 | 5 | { |
| 8 | 6 | /** |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | * @return \Psr\Http\Message\ResponseInterface|\SevenShores\Hubspot\Http\Response |
| 40 | 40 | * @throws \SevenShores\Hubspot\Exceptions\BadRequest |
| 41 | 41 | */ |
| 42 | - function getAll(array $params = []){ |
|
| 42 | + function getAll(array $params = []) { |
|
| 43 | 43 | $endpoint = "https://api.hubapi.com/deals/v1/deal/paged"; |
| 44 | 44 | |
| 45 | 45 | $queryString = build_query_string($params); |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | { |
| 104 | 104 | $endpoint = "https://api.hubapi.com/deals/v1/deal/{$dealId}/associations/COMPANY"; |
| 105 | 105 | |
| 106 | - $queryString = build_query_string(['id' => (array)$companyIds]); |
|
| 106 | + $queryString = build_query_string(['id' => (array) $companyIds]); |
|
| 107 | 107 | |
| 108 | 108 | return $this->client->request('put', $endpoint, [], $queryString); |
| 109 | 109 | } |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | { |
| 118 | 118 | $endpoint = "https://api.hubapi.com/deals/v1/deal/{$dealId}/associations/COMPANY"; |
| 119 | 119 | |
| 120 | - $queryString = build_query_string(['id' => (array)$companyIds]); |
|
| 120 | + $queryString = build_query_string(['id' => (array) $companyIds]); |
|
| 121 | 121 | |
| 122 | 122 | return $this->client->request('delete', $endpoint, [], $queryString); |
| 123 | 123 | } |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | { |
| 132 | 132 | $endpoint = "https://api.hubapi.com/deals/v1/deal/{$dealId}/associations/CONTACT"; |
| 133 | 133 | |
| 134 | - $queryString = build_query_string(['id' => (array)$contactIds]); |
|
| 134 | + $queryString = build_query_string(['id' => (array) $contactIds]); |
|
| 135 | 135 | |
| 136 | 136 | return $this->client->request('put', $endpoint, [], $queryString); |
| 137 | 137 | } |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | { |
| 157 | 157 | $endpoint = "https://api.hubapi.com/deals/v1/deal/{$dealId}/associations/CONTACT"; |
| 158 | 158 | |
| 159 | - $queryString = build_query_string(['id' => (array)$contactIds]); |
|
| 159 | + $queryString = build_query_string(['id' => (array) $contactIds]); |
|
| 160 | 160 | |
| 161 | 161 | return $this->client->request('delete', $endpoint, [], $queryString); |
| 162 | 162 | } |
@@ -7,7 +7,7 @@ discard block |
||
| 7 | 7 | { |
| 8 | 8 | /** |
| 9 | 9 | * @param array $deal Array of deal properties. |
| 10 | - * @return mixed |
|
| 10 | + * @return \Psr\Http\Message\ResponseInterface |
|
| 11 | 11 | * @throws HubSpotException |
| 12 | 12 | */ |
| 13 | 13 | function create(array $deal) |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | /** |
| 23 | 23 | * @param int $id The deal id. |
| 24 | 24 | * @param array $deal The deal properties to update. |
| 25 | - * @return mixed |
|
| 25 | + * @return \Psr\Http\Message\ResponseInterface |
|
| 26 | 26 | */ |
| 27 | 27 | function update($id, array $deal) |
| 28 | 28 | { |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | |
| 51 | 51 | /** |
| 52 | 52 | * @param int $id |
| 53 | - * @return mixed |
|
| 53 | + * @return \Psr\Http\Message\ResponseInterface |
|
| 54 | 54 | */ |
| 55 | 55 | function delete($id) |
| 56 | 56 | { |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | |
| 62 | 62 | /** |
| 63 | 63 | * @param array $params Optional parameters ['limit', 'offset'] |
| 64 | - * @return mixed |
|
| 64 | + * @return \Psr\Http\Message\ResponseInterface |
|
| 65 | 65 | */ |
| 66 | 66 | function getRecentlyModified(array $params = []) |
| 67 | 67 | { |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | |
| 74 | 74 | /** |
| 75 | 75 | * @param array $params Optional parameters ['limit', 'offset'] |
| 76 | - * @return mixed |
|
| 76 | + * @return \Psr\Http\Message\ResponseInterface |
|
| 77 | 77 | */ |
| 78 | 78 | function getRecentlyCreated(array $params = []) |
| 79 | 79 | { |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | |
| 86 | 86 | /** |
| 87 | 87 | * @param int $id |
| 88 | - * @return mixed |
|
| 88 | + * @return \Psr\Http\Message\ResponseInterface |
|
| 89 | 89 | */ |
| 90 | 90 | function getById($id) |
| 91 | 91 | { |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | /** |
| 98 | 98 | * @param int $dealId |
| 99 | 99 | * @param int|int[] $companyIds |
| 100 | - * @return mixed |
|
| 100 | + * @return \Psr\Http\Message\ResponseInterface |
|
| 101 | 101 | */ |
| 102 | 102 | function associateWithCompany($dealId, $companyIds) |
| 103 | 103 | { |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | /** |
| 112 | 112 | * @param int $dealId |
| 113 | 113 | * @param int|int[] $companyIds |
| 114 | - * @return mixed |
|
| 114 | + * @return \Psr\Http\Message\ResponseInterface |
|
| 115 | 115 | */ |
| 116 | 116 | function disassociateFromCompany($dealId, $companyIds) |
| 117 | 117 | { |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | /** |
| 126 | 126 | * @param int $dealId |
| 127 | 127 | * @param int|int[] $contactIds |
| 128 | - * @return mixed |
|
| 128 | + * @return \Psr\Http\Message\ResponseInterface |
|
| 129 | 129 | */ |
| 130 | 130 | function associateWithContact($dealId, $contactIds) |
| 131 | 131 | { |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | /** |
| 140 | 140 | * @param int $contactId |
| 141 | 141 | * @param array $params Optional parameters ['limit', 'offset'] |
| 142 | - * @return mixed |
|
| 142 | + * @return \Psr\Http\Message\ResponseInterface |
|
| 143 | 143 | */ |
| 144 | 144 | function associatedWithContact($contactId, $params = []) |
| 145 | 145 | { |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | /** |
| 154 | 154 | * @param int $dealId |
| 155 | 155 | * @param int|int[] $contactIds |
| 156 | - * @return mixed |
|
| 156 | + * @return \Psr\Http\Message\ResponseInterface |
|
| 157 | 157 | */ |
| 158 | 158 | function disassociateFromContact($dealId, $contactIds) |
| 159 | 159 | { |
@@ -27,7 +27,7 @@ |
||
| 27 | 27 | [ |
| 28 | 28 | 'name' => 'file_names', |
| 29 | 29 | 'contents' => isset($params['file_names']) ? $params['file_names'] : null |
| 30 | - ],[ |
|
| 30 | + ], [ |
|
| 31 | 31 | 'name' => 'folder_paths', |
| 32 | 32 | 'contents' => isset($params['folder_paths']) ? $params['folder_paths'] : null |
| 33 | 33 | ] |
@@ -20,10 +20,10 @@ |
||
| 20 | 20 | $endpoint = "https://api.hubapi.com/email/public/v1/singleEmail/send"; |
| 21 | 21 | |
| 22 | 22 | $options['json'] = [ |
| 23 | - 'emailId' => $id, |
|
| 24 | - 'message' => $message, |
|
| 25 | - 'contactProperties' => $contactProperties, |
|
| 26 | - 'customProperties' => $customProperties |
|
| 23 | + 'emailId' => $id, |
|
| 24 | + 'message' => $message, |
|
| 25 | + 'contactProperties' => $contactProperties, |
|
| 26 | + 'customProperties' => $customProperties |
|
| 27 | 27 | ]; |
| 28 | 28 | |
| 29 | 29 | return $this->client->request('post', $endpoint, $options); |
@@ -70,7 +70,7 @@ |
||
| 70 | 70 | $options["headers"]["User-Agent"] = $this->user_agent; |
| 71 | 71 | |
| 72 | 72 | if ($this->oauth2) { |
| 73 | - $options["headers"]["Authorization"] = "Bearer " . $this->key; |
|
| 73 | + $options["headers"]["Authorization"] = "Bearer ".$this->key; |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | try { |
@@ -147,7 +147,7 @@ |
||
| 147 | 147 | { |
| 148 | 148 | $endpoint = 'https://api.hubapi.com/companies/v2/groups/'; |
| 149 | 149 | |
| 150 | - if($includeProperties){ |
|
| 150 | + if ($includeProperties) { |
|
| 151 | 151 | $queryString = build_query_string(['includeProperties' => 'true']); |
| 152 | 152 | |
| 153 | 153 | return $this->client->request('get', $endpoint, [], $queryString); |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -if (! function_exists('build_query_string')) { |
|
| 3 | +if (!function_exists('build_query_string')) { |
|
| 4 | 4 | /** |
| 5 | 5 | * Generate a query string. |
| 6 | 6 | * |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | if (is_array($value)) { |
| 20 | 20 | $query .= build_batch_query_string($key, $value, $encoding); |
| 21 | 21 | } elseif (!empty($value)) { |
| 22 | - $query .= '&' . url_encode($key, $encoding) . '=' . url_encode($value, $encoding); |
|
| 22 | + $query .= '&'.url_encode($key, $encoding).'='.url_encode($value, $encoding); |
|
| 23 | 23 | } |
| 24 | 24 | } |
| 25 | 25 | |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | } |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | -if (! function_exists('build_batch_query_string')) { |
|
| 30 | +if (!function_exists('build_batch_query_string')) { |
|
| 31 | 31 | /** |
| 32 | 32 | * Generate a query string for batch requests. |
| 33 | 33 | * |
@@ -38,13 +38,13 @@ discard block |
||
| 38 | 38 | */ |
| 39 | 39 | function build_batch_query_string($key, $items, $encoding = PHP_QUERY_RFC3986) |
| 40 | 40 | { |
| 41 | - return array_reduce($items, function ($query, $item) use ($key, $encoding) { |
|
| 42 | - return $query . "&" . url_encode($key, $encoding) . '=' . url_encode($item, $encoding); |
|
| 41 | + return array_reduce($items, function($query, $item) use ($key, $encoding) { |
|
| 42 | + return $query."&".url_encode($key, $encoding).'='.url_encode($item, $encoding); |
|
| 43 | 43 | }, ''); |
| 44 | 44 | } |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | -if (! function_exists('url_encode')) { |
|
| 47 | +if (!function_exists('url_encode')) { |
|
| 48 | 48 | /** |
| 49 | 49 | * Url encode a string. |
| 50 | 50 | * |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | } |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | -if (! function_exists('ms_timestamp')) { |
|
| 70 | +if (!function_exists('ms_timestamp')) { |
|
| 71 | 71 | /** |
| 72 | 72 | * Get a millisecond timestamp from a date or time. |
| 73 | 73 | * |
@@ -32,9 +32,9 @@ |
||
| 32 | 32 | $required['email'] = $contactEmail; |
| 33 | 33 | |
| 34 | 34 | $parameters = array_merge( |
| 35 | - $required, |
|
| 36 | - ['_m' => $contactRevenue], |
|
| 37 | - $contactProperties |
|
| 35 | + $required, |
|
| 36 | + ['_m' => $contactRevenue], |
|
| 37 | + $contactProperties |
|
| 38 | 38 | ); |
| 39 | 39 | |
| 40 | 40 | $query_string = build_query_string($parameters); |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | * @param mixed $timestamp |
| 18 | 18 | * @param array $eventTypeData |
| 19 | 19 | * |
| 20 | - * @return mixed |
|
| 20 | + * @return \Psr\Http\Message\ResponseInterface |
|
| 21 | 21 | * |
| 22 | 22 | * @see http://developers.hubspot.com/docs/methods/timeline/create-or-update-event |
| 23 | 23 | */ |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | * @param int $appId |
| 54 | 54 | * @param array $events |
| 55 | 55 | * |
| 56 | - * @return mixed |
|
| 56 | + * @return \Psr\Http\Message\ResponseInterface |
|
| 57 | 57 | * |
| 58 | 58 | * @see https://developers.hubspot.com/docs/methods/timeline/batch-create-or-update-events |
| 59 | 59 | */ |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | * |
| 72 | 72 | * @param int $appId |
| 73 | 73 | * |
| 74 | - * @return mixed |
|
| 74 | + * @return \Psr\Http\Message\ResponseInterface |
|
| 75 | 75 | * |
| 76 | 76 | * @see http://developers.hubspot.com/docs/methods/timeline/get-event-types |
| 77 | 77 | */ |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | * @param string|null $detailTemplate |
| 91 | 91 | * @param string|null $objectType |
| 92 | 92 | * |
| 93 | - * @return mixed |
|
| 93 | + * @return \Psr\Http\Message\ResponseInterface |
|
| 94 | 94 | * |
| 95 | 95 | * @see http://developers.hubspot.com/docs/methods/timeline/create-event-type |
| 96 | 96 | */ |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | * @param string|null $detailTemplate |
| 125 | 125 | * @param string|null $objectType |
| 126 | 126 | * |
| 127 | - * @return mixed |
|
| 127 | + * @return \Psr\Http\Message\ResponseInterface |
|
| 128 | 128 | * |
| 129 | 129 | * @see http://developers.hubspot.com/docs/methods/timeline/update-event-type |
| 130 | 130 | */ |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | * @param int $appId |
| 156 | 156 | * @param int $eventTypeId |
| 157 | 157 | * |
| 158 | - * @return mixed |
|
| 158 | + * @return \Psr\Http\Message\ResponseInterface |
|
| 159 | 159 | * |
| 160 | 160 | * @see http://developers.hubspot.com/docs/methods/timeline/delete-event-type |
| 161 | 161 | */ |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | * @param int $appId |
| 172 | 172 | * @param int $eventTypeId |
| 173 | 173 | * |
| 174 | - * @return mixed |
|
| 174 | + * @return \Psr\Http\Message\ResponseInterface |
|
| 175 | 175 | * |
| 176 | 176 | * @see http://developers.hubspot.com/docs/methods/timeline/get-timeline-event-type-properties |
| 177 | 177 | */ |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | * @param string|null $objectProperty |
| 193 | 193 | * @param array $options |
| 194 | 194 | * |
| 195 | - * @return mixed |
|
| 195 | + * @return \Psr\Http\Message\ResponseInterface |
|
| 196 | 196 | * |
| 197 | 197 | * @see http://developers.hubspot.com/docs/methods/timeline/create-timeline-event-type-property |
| 198 | 198 | */ |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | * @param string $propertyType |
| 230 | 230 | * @param array|null $options |
| 231 | 231 | * |
| 232 | - * @return mixed |
|
| 232 | + * @return \Psr\Http\Message\ResponseInterface |
|
| 233 | 233 | * |
| 234 | 234 | * @see http://developers.hubspot.com/docs/methods/timeline/udpate-timeline-event-type-property |
| 235 | 235 | */ |
@@ -265,7 +265,7 @@ discard block |
||
| 265 | 265 | * @param int $eventTypeId |
| 266 | 266 | * @param int $eventTypePropertyId |
| 267 | 267 | * |
| 268 | - * @return mixed |
|
| 268 | + * @return \Psr\Http\Message\ResponseInterface |
|
| 269 | 269 | * |
| 270 | 270 | * @see http://developers.hubspot.com/docs/methods/timeline/delete-timeline-event-type-property |
| 271 | 271 | */ |
@@ -57,7 +57,7 @@ |
||
| 57 | 57 | * |
| 58 | 58 | * @see https://developers.hubspot.com/docs/methods/timeline/batch-create-or-update-events |
| 59 | 59 | */ |
| 60 | - public function createOrUpdateBatch($appId,$events=[]) |
|
| 60 | + public function createOrUpdateBatch($appId, $events = []) |
|
| 61 | 61 | { |
| 62 | 62 | $endpoint = "https://api.hubapi.com/integrations/v1/{$appId}/timeline/event/batch"; |
| 63 | 63 | |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | */ |
| 74 | 74 | public function delete($name) |
| 75 | 75 | { |
| 76 | - $endpoint = 'https://api.hubapi.com/properties/v1/deals/properties/named/' . $name; |
|
| 76 | + $endpoint = 'https://api.hubapi.com/properties/v1/deals/properties/named/'.$name; |
|
| 77 | 77 | return $this->client->request('delete', $endpoint); |
| 78 | 78 | } |
| 79 | 79 | |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | { |
| 154 | 154 | $endpoint = "https://api.hubapi.com/properties/v1/deals/groups/named/{$groupName}"; |
| 155 | 155 | |
| 156 | - if($includeProperties){ |
|
| 156 | + if ($includeProperties) { |
|
| 157 | 157 | $queryString = build_query_string(['includeProperties' => 'true']); |
| 158 | 158 | |
| 159 | 159 | return $this->client->request('get', $endpoint, [], $queryString); |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | { |
| 175 | 175 | $endpoint = 'https://api.hubapi.com/properties/v1/deals/groups'; |
| 176 | 176 | |
| 177 | - if($includeProperties){ |
|
| 177 | + if ($includeProperties) { |
|
| 178 | 178 | $queryString = build_query_string(['includeProperties' => 'true']); |
| 179 | 179 | |
| 180 | 180 | return $this->client->request('get', $endpoint, [], $queryString); |