Application   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 15
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 1
lcom 1
cbo 2
dl 15
loc 15
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A list() 6 6 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
 *   This file is part of the Vultr PHP library.
4
 *
5
 *   (c) Albert Leitato <[email protected]>
6
 *
7
 *   For the full copyright and license information, please view the LICENSE
8
 *   file that was distributed with this source code.
9
 */
10
namespace Vultr\Api;
11
12
use Vultr\Entity\Application as ApplicationEntity;
13
14
/**
15
 * @author Albert Leitato <[email protected]>
16
 */
17 View Code Duplication
class Application extends AbstractApi
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...
18
{
19
    /**
20
     * Retrieve a list of available applications.
21
     * These refer to applications that can be launched when creating a Vultr VPS.
22
     *
23
     * @return ApplicationEntity
24
     */
25
    public function list()
26
    {
27
        $response = $this->adapter->get(\sprintf('%s/app/list', $this->endpoint));
28
29
        return $this->handleResponse($response, ApplicationEntity::class, true);
0 ignored issues
show
Bug Compatibility introduced by
The expression $this->handleResponse($r...lication::class, true); of type array|object adds the type array to the return on line 29 which is incompatible with the return type documented by Vultr\Api\Application::list of type Vultr\Entity\Application.
Loading history...
30
    }
31
}
32