Thread   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 26
Duplicated Lines 80.77 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 3
dl 21
loc 26
ccs 12
cts 12
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A pass() 7 7 1
A take() 7 7 1
A request() 7 7 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
declare(strict_types=1);
4
5
namespace Kerox\Messenger\Api;
6
7
use Kerox\Messenger\Model\ThreadControl;
8
use Kerox\Messenger\Request\ThreadRequest;
9
use Kerox\Messenger\Response\ThreadResponse;
10
11
class Thread extends AbstractApi
12
{
13 1 View Code Duplication
    public function pass(ThreadControl $threadControl): ThreadResponse
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
14
    {
15 1
        $request = new ThreadRequest($this->pageToken, $threadControl);
16 1
        $response = $this->client->post('me/pass_thread_control', $request->build());
17
18 1
        return new ThreadResponse($response);
19
    }
20
21 1 View Code Duplication
    public function take(ThreadControl $threadControl): ThreadResponse
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
22
    {
23 1
        $request = new ThreadRequest($this->pageToken, $threadControl);
24 1
        $response = $this->client->post('me/take_thread_control', $request->build());
25
26 1
        return new ThreadResponse($response);
27
    }
28
29 1 View Code Duplication
    public function request(ThreadControl $threadControl): ThreadResponse
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
30
    {
31 1
        $request = new ThreadRequest($this->pageToken, $threadControl);
32 1
        $response = $this->client->post('me/request_thread_control', $request->build());
33
34 1
        return new ThreadResponse($response);
35
    }
36
}
37