Completed
Push — master ( 6dc88d...66bea5 )
by Ryan
02:56 queued 47s
created

Comments   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 32
Duplicated Lines 25 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
dl 8
loc 32
rs 10
c 0
b 0
f 0
wmc 2
lcom 1
cbo 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getById() 0 6 1
A all() 8 8 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
namespace SevenShores\Hubspot\Resources;
4
5
class Comments extends Resource
6
{
7
    /**
8
     * Get all comments.
9
     *
10
     * @param array $params Optional parameters ['limit', 'offset', 'portalId', 'state', 'contentId', 'reverse']
11
     * @return \SevenShores\Hubspot\Http\Response
12
     */
13 View Code Duplication
    function all($params = [])
0 ignored issues
show
Best Practice introduced by
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/comments/v3/comments';
16
17
        $queryString = build_query_string($params);
18
19
        return $this->client->request('get', $endpoint, [], $queryString);
20
    }
21
22
    /**
23
     * Get information about a specific comment.
24
     *
25
     * @param string $id
26
     * @return \SevenShores\Hubspot\Http\Response
27
     */
28
    function getById($id)
0 ignored issues
show
Best Practice introduced by
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/comments/v3/comments/{$id}";
31
32
        return $this->client->request('get', $endpoint);
33
    }
34
35
36
}
37