Issues (318)

Security Analysis    no request data  

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

src/Resources/ContactProperties.php (10 issues)

Upgrade to new PHP Analysis Engine

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 ContactProperties extends Resource
6
{
7
    /**
8
     * Get all Contact properties.
9
     *
10
     * Properties in HubSpot are fields that have been created, in this case for deals in a given portal.
11
     * This endpoint will return all of the contacts properties, including their definition, for a given portal.
12
     *
13
     * @see http://developers.hubspot.com/docs/methods/contacts/v2/get_contacts_properties
14
     *
15
     * @return \SevenShores\Hubspot\Http\Response
16
     */
17
    function all()
0 ignored issues
show
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
18
    {
19
        $endpoint = 'https://api.hubapi.com/contacts/v2/properties';
20
21
        return $this->client->request('get', $endpoint);
22
    }
23
24
    /**
25
     * Get a Contact Property.
26
     *
27
     * Returns a JSON object representing the definition for a given contact property.
28
     *
29
     * @see http://developers.hubspot.com/docs/methods/companies/get_contact_property
30
     *
31
     * @param string $name The name of the property.
32
     * @return \SevenShores\Hubspot\Http\Response
33
     */
34
    function get($name)
0 ignored issues
show
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
35
    {
36
        $endpoint = "https://api.hubapi.com/contacts/v2/properties/named/{$name}";
37
38
        return $this->client->request('get', $endpoint);
39
    }
40
41
    /**
42
     * Create a contact property.
43
     *
44
     * Create a property on every contact object to store a specific piece of data. In the example below,
45
     * we want to store an invoice number on a separate field on deals.
46
     *
47
     * @see http://developers.hubspot.com/docs/methods/contacts/v2/create_contacts_property
48
     *
49
     * @param array $property
50
     * @return \SevenShores\Hubspot\Http\Response
51
     */
52
    function create($property)
0 ignored issues
show
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
53
    {
54
        $endpoint = "https://api.hubapi.com/contacts/v2/properties";
55
56
        $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 $myArray is initialized the first time when the foreach loop is entered. You can also see that the value of the bar key is only written conditionally; thus, its value might result from a previous iteration.

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...
57
58
        return $this->client->request('post', $endpoint, $options);
59
    }
60
61
    /**
62
     * Update a contact property.
63
     *
64
     * Update a specified contact property.
65
     *
66
     * @see http://developers.hubspot.com/docs/methods/contacts/v2/update_contact_property
67
     *
68
     * @param string $name
69
     * @param array  $property
70
     * @return \SevenShores\Hubspot\Http\Response
71
     */
72
    function update($name, $property)
0 ignored issues
show
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
73
    {
74
        $endpoint = "https://api.hubapi.com/contacts/v2/properties/named/{$name}";
75
76
        $property['name'] = $name;
77
        $options['json'] = $property;
78
79
        return $this->client->request('put', $endpoint, $options);
80
    }
81
82
    /**
83
     * Delete a contact property.
84
     *
85
     * For a portal, delete an existing contact property.
86
     *
87
     * @see http://developers.hubspot.com/docs/methods/contacts/v2/delete_contact_property
88
     *
89
     * @param string $name
90
     * @return \SevenShores\Hubspot\Http\Response
91
     */
92
    function delete($name)
0 ignored issues
show
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
93
    {
94
        $endpoint = "https://api.hubapi.com/contacts/v2/properties/named/{$name}";
95
96
        return $this->client->request('delete', $endpoint);
97
    }
98
99
    /**
100
     * Get contact property groups.
101
     *
102
     * Returns all of the contact property groups for a given portal.
103
     *
104
     * @see http://developers.hubspot.com/docs/methods/contacts/v2/get_contact_property_groups
105
     *
106
     * @param bool $includeProperties
107
     * @return \SevenShores\Hubspot\Http\Response
108
     */
109
    function getGroups($includeProperties = false)
0 ignored issues
show
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
110
    {
111
        $endpoint = "https://api.hubapi.com/contacts/v2/groups";
112
113
        $queryString = build_query_string(['includeProperties' => $includeProperties]);
114
115
        return $this->client->request('get', $endpoint, [], $queryString);
116
    }
117
118
    /**
119
     * Create a contact property group.
120
     *
121
     * Create a new contact property group to gather like contact-level data. Property groups allow you to more
122
     * easily manage properties in a given portal and make contact records easier to parse for the user.
123
     *
124
     * @see http://developers.hubspot.com/docs/methods/contacts/v2/create_contacts_property_group
125
     *
126
     * @param array $group Group properties
127
     * @return \SevenShores\Hubspot\Http\Response
128
     */
129
    function createGroup($group)
0 ignored issues
show
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
130
    {
131
        $endpoint = "https://api.hubapi.com/contacts/v2/groups";
132
133
        $options['json'] = $group;
134
135
        return $this->client->request('post', $endpoint, $options);
136
    }
137
138
    /**
139
     * Update a property group.
140
     *
141
     * Update a previously created contact property group.
142
     *
143
     * @see http://developers.hubspot.com/docs/methods/contacts/v2/update_contact_property_group
144
     *
145
     * @param string $name
146
     * @param array  $group
147
     * @return \SevenShores\Hubspot\Http\Response
148
     */
149
    function updateGroup($name, $group)
0 ignored issues
show
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
150
    {
151
        $endpoint = "https://api.hubapi.com/contacts/v2/groups/named/{$name}";
152
153
        $group['name'] = $name;
154
        $options['json'] = $group;
155
156
        return $this->client->request('put', $endpoint, $options);
157
    }
158
159
    /**
160
     * Delete a property group.
161
     *
162
     * Delete an existing contact property group.
163
     *
164
     * @see http://developers.hubspot.com/docs/methods/contacts/v2/delete_contact_property_group
165
     *
166
     * @param string $name
167
     * @return \SevenShores\Hubspot\Http\Response
168
     */
169
    function deleteGroup($name)
0 ignored issues
show
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
170
    {
171
        $endpoint = "https://api.hubapi.com/contacts/v2/groups/named/{$name}";
172
173
        return $this->client->request('delete', $endpoint);
174
    }
175
}
176