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/BlogPosts.php (17 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 BlogPosts extends Resource
6
{
7
    /**
8
     * Create a new blog post.
9
     *
10
     * @param  array $params Optional Parameters.
11
     * @return \SevenShores\Hubspot\Http\Response
12
     */
13
    function create($params = [])
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...
14
    {
15
        $endpoint = 'https://api.hubapi.com/content/api/v2/blog-posts';
16
17
        $options['json'] = $params;
18
19
        return $this->client->request('post', $endpoint, $options);
20
    }
21
22
    /**
23
     * Get all blog posts.
24
     *
25
     * @param  array $params Optional parameters.
26
     * @return \SevenShores\Hubspot\Http\Response
27
     */
28
    function all($params = [])
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...
29
    {
30
        $endpoint = "https://api.hubapi.com/content/api/v2/blog-posts";
31
32
        $queryString = build_query_string($params);
33
34
        return $this->client->request('get', $endpoint, [], $queryString);
35
    }
36
37
    /**
38
     * Update a blog post.
39
     *
40
     * @param  int   $id     The blog post id.
41
     * @param  array $params The blog post fields to update.
42
     * @return \SevenShores\Hubspot\Http\Response
43
     */
44
    function update($id, $params = [])
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...
45
    {
46
        $endpoint = "https://api.hubapi.com/content/api/v2/blog-posts/{$id}";
47
48
        $options['json'] = $params;
49
50
        return $this->client->request('put', $endpoint, $options);
51
    }
52
53
    /**
54
     * Delete a blog post.
55
     *
56
     * @param  int $id
57
     * @return \SevenShores\Hubspot\Http\Response
58
     */
59
    function delete($id)
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...
60
    {
61
        $endpoint = "https://api.hubapi.com/content/api/v2/blog-posts/{$id}";
62
63
        return $this->client->request('delete', $endpoint);
64
    }
65
66
    /**
67
     * Get a specific blog post.
68
     *
69
     * @param  int $id
70
     * @return \SevenShores\Hubspot\Http\Response
71
     */
72
    function getById($id)
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/content/api/v2/blog-posts/{$id}";
75
76
        return $this->client->request('get', $endpoint);
77
    }
78
79
    /**
80
     * Updates the auto-save buffer. Live objects will not be impacted.
81
     *
82
     * @see http://developers.hubspot.com/docs/methods/blogv2/put_blog_posts_blog_post_id_buffer
83
     *
84
     * @param  int   $id     The blog post ID.
85
     * @param  array $params Allowed parameters.
86
     * @return \SevenShores\Hubspot\Http\Response
87
     */
88
    function updateAutoSaveBuffer($id, $params = [])
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...
89
    {
90
        $endpoint = "https://api.hubapi.com/content/api/v2/blog-posts/{$id}/buffer";
91
92
        $options['json'] = $params;
93
94
        return $this->client->request('put', $endpoint, $options);
95
    }
96
97
    /**
98
     * Gets the current contents of the auto-save buffer.
99
     *
100
     * @param  int $id The blog post ID
101
     * @return \SevenShores\Hubspot\Http\Response
102
     */
103
    function getAutoSaveBufferContents($id)
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...
104
    {
105
        $endpoint = "https://api.hubapi.com/content/api/v2/blog-posts/{$id}/buffer";
106
107
        return $this->client->request('get', $endpoint);
108
    }
109
110
    /**
111
     * Clone the blog post.
112
     * Requires including a request body of {"name": "New Page Name"}
113
     *
114
     * @param  int $id The blog post ID
115
     * @param  string $name The cloned post name
116
     * @return \SevenShores\Hubspot\Http\Response
117
     */
118 View Code Duplication
    function clonePost($id, $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...
119
    {
120
        $endpoint = "https://api.hubapi.com/content/api/v2/blog-posts/{$id}/clone";
121
122
        $options['json'] = ['name' => $name];
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...
123
124
        return $this->client->request('post', $endpoint, $options);
125
    }
126
127
    /**
128
     * Determine if the auto-save buffer differs from the live blog post.
129
     *
130
     * @param  int $id The blog post ID
131
     * @return \SevenShores\Hubspot\Http\Response
132
     */
133
    function hasBufferedChanges($id)
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...
134
    {
135
        $endpoint = "https://api.hubapi.com/content/api/v2/blog-posts/{$id}/has-buffered-changes";
136
137
        return $this->client->request('get', $endpoint);
138
    }
139
140
    /**
141
     * Either publishes or cancels publishing based on the POSTed JSON.
142
     *
143
     * Allowable actions are: "push-buffer-live", "schedule-publish", "cancel-publish".
144
     * "push-buffer-live": copies the current contents of the auto-save buffer into the live object.
145
     * "schedule-publish": which pushes the buffer live and then sets up the content for publishing at
146
     *     the existing publish_date time.
147
     * "cancel-publish": cancels a previous schedule-publish action.
148
     *
149
     * @param  int    $id     The blog post ID
150
     * @param  string $action The publish action
151
     * @return \SevenShores\Hubspot\Http\Response
152
     */
153 View Code Duplication
    function publishAction($id, $action)
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...
154
    {
155
        $endpoint = "https://api.hubapi.com/content/api/v2/blog-posts/{$id}/publish-action";
156
157
        $options['json'] = ['action' => $action];
158
159
        return $this->client->request('post', $endpoint, $options);
160
    }
161
162
    /**
163
     * Copies the contents of the auto-save buffer into the live blog post.
164
     *
165
     * @param  int $id The blog post ID
166
     * @return \SevenShores\Hubspot\Http\Response
167
     */
168
    function pushBufferLive($id)
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...
169
    {
170
        $endpoint = "https://api.hubapi.com/content/api/v2/blog-posts/{$id}/push-buffer-live";
171
172
        return $this->client->request('post', $endpoint);
173
    }
174
175
    /**
176
     * Restores a previously deleted blog post.
177
     *
178
     * @param  int $id The blog post ID
179
     * @return \SevenShores\Hubspot\Http\Response
180
     */
181
    function restoreDeleted($id)
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...
182
    {
183
        $endpoint = "https://api.hubapi.com/content/api/v2/blog-posts/{$id}/restore-deleted";
184
185
        return $this->client->request('post', $endpoint);
186
    }
187
188
    /**
189
     * Validates the auto-save buffer version of the blog post.
190
     *
191
     * @param  int $id The blog post ID
192
     * @return \SevenShores\Hubspot\Http\Response
193
     */
194
    function validateBuffer($id)
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...
195
    {
196
        $endpoint = "https://api.hubapi.com/content/api/v2/blog-posts/{$id}/validate-buffer";
197
198
        return $this->client->request('post', $endpoint);
199
    }
200
201
    /**
202
     * List previous versions of the blog post.
203
     *
204
     * @param  int $id The blog post ID
205
     * @return \SevenShores\Hubspot\Http\Response
206
     */
207
    function versions($id)
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...
208
    {
209
        $endpoint = "https://api.hubapi.com/content/api/v2/blog-posts/{$id}/versions";
210
211
        return $this->client->request('get', $endpoint);
212
    }
213
214
    /**
215
     * Get a previous version of the blog post.
216
     *
217
     * @param int $post_id    The blog post ID
218
     * @param int $version_id The version ID
219
     * @return \SevenShores\Hubspot\Http\Response
220
     */
221
    function getVersion($post_id, $version_id)
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...
222
    {
223
        $endpoint = "https://api.hubapi.com/content/api/v2/blog-posts/{$post_id}/versions/{$version_id}";
224
225
        return $this->client->request('get', $endpoint);
226
    }
227
228
    /**
229
     * Restore a previous version of the blog post.
230
     *
231
     * @param int $post_id    The blog post ID
232
     * @param int $version_id The version ID
233
     * @return \SevenShores\Hubspot\Http\Response
234
     */
235 View Code Duplication
    function restoreVersion($post_id, $version_id)
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...
236
    {
237
        $endpoint = "https://api.hubapi.com/content/api/v2/blog-posts/{$post_id}/versions/restore";
238
239
        $options['json'] = compact('version_id');
240
241
        return $this->client->request('post', $endpoint, $options);
242
    }
243
}
244