Completed
Pull Request — master (#30)
by Romain
02:57 queued 31s
created

Insights   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 3
dl 0
loc 36
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A threads() 0 7 1
A feedback() 0 7 1
1
<?php
2
namespace Kerox\Messenger\Api;
3
4
use GuzzleHttp\ClientInterface;
5
use Kerox\Messenger\Request\InsightsRequest;
6
use Kerox\Messenger\Response\InsightsResponse;
7
8
class Insights extends AbstractApi
9
{
10
11
    /**
12
     * Insights constructor.
13
     *
14
     * @param string $pageToken
15
     * @param \GuzzleHttp\ClientInterface $client
16
     */
17 3
    public function __construct($pageToken, ClientInterface $client)
18
    {
19 3
        parent::__construct($pageToken, $client);
20 3
    }
21
22
    /**
23
     * @return \Kerox\Messenger\Response\InsightsResponse
24
     */
25 2
    public function threads(): InsightsResponse
26
    {
27 2
        $request = new InsightsRequest($this->pageToken);
28 2
        $response = $this->client->get('me/insights/page_messages_active_threads_unique', $request->build());
29
30 2
        return new InsightsResponse($response);
31
    }
32
33
    /**
34
     * @return \Kerox\Messenger\Response\InsightsResponse
35
     */
36
    public function feedback(): InsightsResponse
37
    {
38
        $request = new InsightsRequest($this->pageToken);
39
        $response = $this->client->get('me/insights/page_messages_feedback_by_action_unique', $request->build());
40
41
        return new InsightsResponse($response);
42
    }
43
}
44