GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 3b033a...7f82f7 )
by Dragos
14:20
created

Manager   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 29
Duplicated Lines 34.48 %

Coupling/Cohesion

Components 1
Dependencies 5

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 3
c 1
b 0
f 1
lcom 1
cbo 5
dl 10
loc 29
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getManager() 10 10 2
A getMyManager() 0 4 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 Speicher210\KontaktIO\Resource;
4
5
use GuzzleHttp\Exception\ClientException;
6
use Speicher210\KontaktIO\AbstractResource;
7
use Speicher210\KontaktIO\Model\Manager as ManagerModel;
8
9
/**
10
 * Manager resource.
11
 */
12
class Manager extends AbstractResource
13
{
14
    /**
15
     * Get a manager.
16
     *
17
     * @param string $id The manager UUID.
18
     * @return ManagerModel
19
     */
20 View Code Duplication
    public function getManager($id)
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...
21
    {
22
        try {
23
            $response = $this->client->get('/manager/'.$id);
24
25
            return $this->serializer->deserialize($response->getBody(), ManagerModel::class, 'json');
26
        } catch (ClientException $e) {
27
            throw $this->createApiException($e);
28
        }
29
    }
30
31
    /**
32
     * Get the manager for the user owing the API key.
33
     *
34
     * @return ManagerModel
35
     */
36
    public function getMyManager()
37
    {
38
        return $this->getManager('me');
39
    }
40
}
41