ryanwinchester /
hubspot-php
This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | |||
| 3 | namespace SevenShores\Hubspot\Resources; |
||
| 4 | |||
| 5 | class CompanyProperties extends Resource |
||
| 6 | { |
||
| 7 | /** |
||
| 8 | * Creates a property on every company object to store a specific piece of data. |
||
| 9 | * @param array $property |
||
| 10 | * |
||
| 11 | * @see http://developers.hubspot.com/docs/methods/companies/create_company_property |
||
| 12 | * |
||
| 13 | * @return \SevenShores\Hubspot\Http\Response |
||
| 14 | */ |
||
| 15 | function create($property) |
||
|
0 ignored issues
–
show
|
|||
| 16 | { |
||
| 17 | $endpoint = 'https://api.hubapi.com/companies/v2/properties/'; |
||
| 18 | |||
| 19 | $options['json'] = $property; |
||
|
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
$options was never initialized. Although not strictly required by PHP, it is generally a good practice to add $options = array(); before regardless.
Adding an explicit array definition is generally preferable to implicit array definition as it guarantees a stable state of the code. Let’s take a look at an example: foreach ($collection as $item) {
$myArray['foo'] = $item->getFoo();
if ($item->hasBar()) {
$myArray['bar'] = $item->getBar();
}
// do something with $myArray
}
As you can see in this example, the array This might or might not be intended. To make your intention clear, your code more readible and to avoid accidental bugs, we recommend to add an explicit initialization $myArray = array() either outside or inside the foreach loop. Loading history...
|
|||
| 20 | |||
| 21 | return $this->client->request('post', $endpoint, $options); |
||
| 22 | } |
||
| 23 | |||
| 24 | /** |
||
| 25 | * Update the specified company-level property. This does not update the value on a specified company, but instead changes the definition of the company property. |
||
| 26 | * @param string $propertyName |
||
| 27 | * @param array $property |
||
| 28 | * |
||
| 29 | * @see http://developers.hubspot.com/docs/methods/companies/update_company_property |
||
| 30 | * |
||
| 31 | * @return \SevenShores\Hubspot\Http\Response |
||
| 32 | */ |
||
| 33 | function update($propertyName, $property) |
||
|
0 ignored issues
–
show
|
|||
| 34 | { |
||
| 35 | $endpoint = "https://api.hubapi.com/companies/v2/properties/named/{$propertyName}"; |
||
| 36 | |||
| 37 | $property['name'] = $propertyName; |
||
| 38 | $options['json'] = $property; |
||
|
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
$options was never initialized. Although not strictly required by PHP, it is generally a good practice to add $options = array(); before regardless.
Adding an explicit array definition is generally preferable to implicit array definition as it guarantees a stable state of the code. Let’s take a look at an example: foreach ($collection as $item) {
$myArray['foo'] = $item->getFoo();
if ($item->hasBar()) {
$myArray['bar'] = $item->getBar();
}
// do something with $myArray
}
As you can see in this example, the array This might or might not be intended. To make your intention clear, your code more readible and to avoid accidental bugs, we recommend to add an explicit initialization $myArray = array() either outside or inside the foreach loop. Loading history...
|
|||
| 39 | |||
| 40 | return $this->client->request('put', $endpoint, $options); |
||
| 41 | } |
||
| 42 | |||
| 43 | /** |
||
| 44 | * For a portal, delete an existing company property. |
||
| 45 | * @param string $propertyName The API name of the property that you will be deleting. |
||
| 46 | * |
||
| 47 | * @see http://developers.hubspot.com/docs/methods/companies/delete_company_property |
||
| 48 | * |
||
| 49 | * @return \SevenShores\Hubspot\Http\Response |
||
| 50 | */ |
||
| 51 | function delete($propertyName) |
||
|
0 ignored issues
–
show
|
|||
| 52 | { |
||
| 53 | $endpoint = "https://api.hubapi.com/companies/v2/properties/named/{$propertyName}"; |
||
| 54 | |||
| 55 | return $this->client->request('delete', $endpoint); |
||
| 56 | } |
||
| 57 | |||
| 58 | /** |
||
| 59 | * Returns a JSON object representing the definition for a given company property. |
||
| 60 | * @param string $propertyName The API name of the property that you wish to see metadata for. |
||
| 61 | * |
||
| 62 | * @see http://developers.hubspot.com/docs/methods/companies/get_company_property |
||
| 63 | * |
||
| 64 | * @return \SevenShores\Hubspot\Http\Response |
||
| 65 | */ |
||
| 66 | function get($propertyName) |
||
|
0 ignored issues
–
show
|
|||
| 67 | { |
||
| 68 | $endpoint = "https://api.hubapi.com/companies/v2/properties/named/{$propertyName}"; |
||
| 69 | |||
| 70 | return $this->client->request('get', $endpoint); |
||
| 71 | } |
||
| 72 | |||
| 73 | /** |
||
| 74 | * Returns all of the company properties, including their definition. |
||
| 75 | * |
||
| 76 | * @see http://developers.hubspot.com/docs/methods/companies/get_company_properties |
||
| 77 | * |
||
| 78 | * @return \SevenShores\Hubspot\Http\Response |
||
| 79 | */ |
||
| 80 | function all() |
||
|
0 ignored issues
–
show
|
|||
| 81 | { |
||
| 82 | $endpoint = 'https://api.hubapi.com/companies/v2/properties/'; |
||
| 83 | |||
| 84 | return $this->client->request('get', $endpoint); |
||
| 85 | } |
||
| 86 | |||
| 87 | /** |
||
| 88 | * Create a new company property group to gather like company-level data. |
||
| 89 | * @param array $group Defines the group and any properties within it. |
||
| 90 | * |
||
| 91 | * @see http://developers.hubspot.com/docs/methods/companies/create_company_property_group |
||
| 92 | * |
||
| 93 | * @return \SevenShores\Hubspot\Http\Response |
||
| 94 | */ |
||
| 95 | function createGroup($group) |
||
|
0 ignored issues
–
show
|
|||
| 96 | { |
||
| 97 | $endpoint = 'https://api.hubapi.com/companies/v2/groups/'; |
||
| 98 | |||
| 99 | $options['json'] = $group; |
||
|
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
$options was never initialized. Although not strictly required by PHP, it is generally a good practice to add $options = array(); before regardless.
Adding an explicit array definition is generally preferable to implicit array definition as it guarantees a stable state of the code. Let’s take a look at an example: foreach ($collection as $item) {
$myArray['foo'] = $item->getFoo();
if ($item->hasBar()) {
$myArray['bar'] = $item->getBar();
}
// do something with $myArray
}
As you can see in this example, the array This might or might not be intended. To make your intention clear, your code more readible and to avoid accidental bugs, we recommend to add an explicit initialization $myArray = array() either outside or inside the foreach loop. Loading history...
|
|||
| 100 | |||
| 101 | return $this->client->request('post', $endpoint, $options); |
||
| 102 | } |
||
| 103 | |||
| 104 | /** |
||
| 105 | * Update a previously created company property group. |
||
| 106 | * @param string $groupName The API name of the property group that you will be updating. |
||
| 107 | * @param array $group Defines the property group and any properties within it. |
||
| 108 | * |
||
| 109 | * @see http://developers.hubspot.com/docs/methods/companies/update_company_property_group |
||
| 110 | * |
||
| 111 | * @return \SevenShores\Hubspot\Http\Response |
||
| 112 | */ |
||
| 113 | function updateGroup($groupName, $group) |
||
|
0 ignored issues
–
show
|
|||
| 114 | { |
||
| 115 | $endpoint = "https://api.hubapi.com/companies/v2/groups/named/{$groupName}"; |
||
| 116 | |||
| 117 | $group['name'] = $groupName; |
||
| 118 | $options['json'] = $group; |
||
|
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
$options was never initialized. Although not strictly required by PHP, it is generally a good practice to add $options = array(); before regardless.
Adding an explicit array definition is generally preferable to implicit array definition as it guarantees a stable state of the code. Let’s take a look at an example: foreach ($collection as $item) {
$myArray['foo'] = $item->getFoo();
if ($item->hasBar()) {
$myArray['bar'] = $item->getBar();
}
// do something with $myArray
}
As you can see in this example, the array This might or might not be intended. To make your intention clear, your code more readible and to avoid accidental bugs, we recommend to add an explicit initialization $myArray = array() either outside or inside the foreach loop. Loading history...
|
|||
| 119 | |||
| 120 | return $this->client->request('put', $endpoint, $options); |
||
| 121 | } |
||
| 122 | |||
| 123 | /** |
||
| 124 | * Delete an existing company property group. |
||
| 125 | * @param string $groupName The API name of the property group that you will be deleting. |
||
| 126 | * |
||
| 127 | * @see http://developers.hubspot.com/docs/methods/companies/delete_company_property_group |
||
| 128 | * |
||
| 129 | * @return \SevenShores\Hubspot\Http\Response |
||
| 130 | */ |
||
| 131 | function deleteGroup($groupName) |
||
|
0 ignored issues
–
show
|
|||
| 132 | { |
||
| 133 | $endpoint = "https://api.hubapi.com/companies/v2/groups/named/{$groupName}"; |
||
| 134 | |||
| 135 | return $this->client->request('delete', $endpoint); |
||
| 136 | } |
||
| 137 | |||
| 138 | /** |
||
| 139 | * Returns all of the company property groups for a given portal. |
||
| 140 | * @param bool $includeProperties If true returns all of the properties for each company property group. |
||
| 141 | * |
||
| 142 | * @see http://developers.hubspot.com/docs/methods/companies/get_company_property_groups |
||
| 143 | * |
||
| 144 | * @return \SevenShores\Hubspot\Http\Response |
||
| 145 | */ |
||
| 146 | View Code Duplication | function getAllGroups($includeProperties = false) |
|
|
0 ignored issues
–
show
|
|||
| 147 | { |
||
| 148 | $endpoint = 'https://api.hubapi.com/companies/v2/groups/'; |
||
| 149 | |||
| 150 | if($includeProperties){ |
||
| 151 | $queryString = build_query_string(['includeProperties' => 'true']); |
||
| 152 | |||
| 153 | return $this->client->request('get', $endpoint, [], $queryString); |
||
| 154 | } |
||
| 155 | |||
| 156 | return $this->client->request('get', $endpoint); |
||
| 157 | } |
||
| 158 | } |
||
| 159 |
Adding explicit visibility (
private,protected, orpublic) is generally recommend to communicate to other developers how, and from where this method is intended to be used.