Completed
Pull Request — master (#15)
by Nick
07:21 queued 02:21
created

DecideManager   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 23
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 0
Metric Value
wmc 1
c 0
b 0
f 0
lcom 1
cbo 4
dl 23
loc 23
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A add() 9 9 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 Acquia\LiftClient\Manager;
4
5
use Acquia\LiftClient\Entity\Decide;
6
use GuzzleHttp\Psr7\Request;
7
8 View Code Duplication
class DecideManager extends ManagerBase
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...
9
{
10
    /**
11
     * Make one or more decisions.
12
     *
13
     * @see http://docs.decision-api.acquia.com/#decide_post
14
     *
15
     * @param \Acquia\LiftClient\Entity\Decide $decide
16
     *
17
     * @throws \GuzzleHttp\Exception\RequestException
18
     *
19
     * @return \Acquia\LiftClient\Entity\DecideResponse
20
     */
21
    public function add(Decide $decide)
22
    {
23
        $body = $decide->json();
24
        $url = '/capture';
25
        $request = new Request('POST', $url, [], $body);
26
        $data = $this->client->getResponseJson($request);
27
28
        return new DecideResponse($data);
29
    }
30
}
31