Passed
Pull Request — master (#91)
by Romain
02:54
created

Thread::getInstance()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 7
ccs 2
cts 2
cp 1
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 3
nc 2
nop 2
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Kerox\Messenger\Api;
6
7
use GuzzleHttp\ClientInterface;
8
use Kerox\Messenger\Model\ThreadControl;
9
use Kerox\Messenger\Request\ThreadRequest;
10
use Kerox\Messenger\Response\ThreadResponse;
11
12
class Thread extends AbstractApi
13
{
14
    /**
15
     * @param \Kerox\Messenger\Model\ThreadControl $threadControl
16
     *
17
     * @return \Kerox\Messenger\Response\ThreadResponse
18
     */
19
    public function pass(ThreadControl $threadControl): ThreadResponse
20
    {
21
        $request = new ThreadRequest($this->pageToken, $threadControl);
22
        $response = $this->client->post('me/pass_thread_control', $request->build());
23 3
24
        return new ThreadResponse($response);
25 3
    }
26 3
27
    /**
28
     * @param \Kerox\Messenger\Model\ThreadControl $threadControl
29
     *
30
     * @return \Kerox\Messenger\Response\ThreadResponse
31
     */
32
    public function take(ThreadControl $threadControl): ThreadResponse
33
    {
34 1
        $request = new ThreadRequest($this->pageToken, $threadControl);
35
        $response = $this->client->post('me/take_thread_control', $request->build());
36 1
37 1
        return new ThreadResponse($response);
38
    }
39
}
40