Agent   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 35
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 5

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 5
dl 35
loc 35
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A current() 4 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
 * Created by PhpStorm.
4
 * User: Matt
5
 * Date: 20/04/2016
6
 * Time: 2:32 PM
7
 */
8
9
namespace Freshdesk\Resources;
10
11
use Freshdesk\Resources\Traits\AllTrait;
12
use Freshdesk\Resources\Traits\CreateTrait;
13
use Freshdesk\Resources\Traits\ViewTrait;
14
15
/**
16
 * Agent resource
17
 *
18
 * This provides access to the agent resources
19
 *
20
 * @package Api\Resources
21
 */
22 View Code Duplication
class Agent extends AbstractResource
0 ignored issues
show
Duplication introduced by
This class 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...
23
{
24
25
    use AllTrait, CreateTrait, ViewTrait;
26
27
    /**
28
     * The resource endpoint
29
     * @internal
30
     * @var string
31
     */
32
    protected $endpoint = '/agents';
33
34
    /**
35
     *
36
     * Get the currently authenticated agent
37
     *
38
     * @api
39
     * @param array|null $query
40
     * @return array|null
41
     * @throws \Freshdesk\Exceptions\AccessDeniedException
42
     * @throws \Freshdesk\Exceptions\ApiException
43
     * @throws \Freshdesk\Exceptions\AuthenticationException
44
     * @throws \Freshdesk\Exceptions\ConflictingStateException
45
     * @throws \Freshdesk\Exceptions\NotFoundException
46
     * @throws \Freshdesk\Exceptions\RateLimitExceededException
47
     * @throws \Freshdesk\Exceptions\UnsupportedContentTypeException
48
     * @throws \Freshdesk\Exceptions\MethodNotAllowedException
49
     * @throws \Freshdesk\Exceptions\UnsupportedAcceptHeaderException
50
     * @throws \Freshdesk\Exceptions\ValidationException
51
     */
52
    public function current(array $query = null)
53
    {
54
        return $this->api()->request('GET', $this->endpoint('me'), null, $query);
55
    }
56
}
57