SocialMedia   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 84
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

6 Methods

Rating   Name   Duplication   Size   Complexity  
A channels() 0 6 1
A getChannelById() 0 6 1
A broadcasts() 0 8 1
A getBroadcastById() 0 6 1
A createBroadcast() 0 8 1
A cancelBroadcast() 0 6 1
1
<?php
2
3
namespace SevenShores\Hubspot\Resources;
4
5
class SocialMedia extends Resource
6
{
7
    /**
8
     * Get all publishing channels.
9
     *
10
     * @return \SevenShores\Hubspot\Http\Response
11
     */
12
    function channels()
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...
13
    {
14
        $endpoint = 'https://api.hubapi.com/broadcast/v1/channels/setting/publish/current';
15
16
        return $this->client->request('get', $endpoint);
17
    }
18
19
    /**
20
     * Get a broadcast channel.
21
     *
22
     * @param string $channel_guid
23
     * @return \SevenShores\Hubspot\Http\Response
24
     */
25
    function getChannelById($channel_guid)
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...
26
    {
27
        $endpoint = "https://api.hubapi.com/broadcast/v1/channels/{$channel_guid}";
28
29
        return $this->client->request('get', $endpoint);
30
    }
31
32
    /**
33
     * Get all broadcast messages.
34
     *
35
     * @param array $params
36
     * @return \SevenShores\Hubspot\Http\Response
37
     */
38
    function broadcasts($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...
39
    {
40
        $endpoint = "https://api.hubapi.com/broadcast/v1/broadcasts";
41
42
        $queryString = build_query_string($params);
43
44
        return $this->client->request('get', $endpoint, [], $queryString);
45
    }
46
47
    /**
48
     * Get a broadcast.
49
     *
50
     * @param string $broadcast_guid
51
     * @return \SevenShores\Hubspot\Http\Response
52
     */
53
    function getBroadcastById($broadcast_guid)
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...
54
    {
55
        $endpoint = "https://api.hubapi.com/broadcast/v1/broadcasts/{$broadcast_guid}";
56
57
        return $this->client->request('get', $endpoint);
58
    }
59
60
    /**
61
     * Create a new broadcast message.
62
     *
63
     * @param array $broadcast
64
     * @return \SevenShores\Hubspot\Http\Response
65
     */
66
    function createBroadcast($broadcast)
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...
67
    {
68
        $endpoint = "https://api.hubapi.com/broadcast/v1/broadcasts";
69
70
        $options['json'] = $broadcast;
71
72
        return $this->client->request('post', $endpoint, $options);
73
    }
74
75
    /**
76
     * Cancel a broadcast message.
77
     *
78
     * @param string $broadcast_guid
79
     * @return \SevenShores\Hubspot\Http\Response
80
     */
81
    function cancelBroadcast($broadcast_guid)
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...
82
    {
83
        $endpoint = "https://api.hubapi.com/broadcast/v1/broadcasts/{$broadcast_guid}";
84
85
        return $this->client->request('delete', $endpoint);
86
    }
87
88
}
89