Completed
Pull Request — master (#15)
by Nick
04:01
created

DecideManager::decide()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 6

Duplication

Lines 9
Ratio 100 %

Importance

Changes 0
Metric Value
dl 9
loc 9
rs 9.6666
c 0
b 0
f 0
cc 1
eloc 6
nc 1
nop 1
1
<?php
2
3
namespace Acquia\LiftClient\Manager;
4
5
use Acquia\LiftClient\Entity\Decide;
6
use Acquia\LiftClient\Entity\DecideResponse;
7
use GuzzleHttp\Psr7\Request;
8
9 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...
10
{
11
    /**
12
     * Make one or more decisions.
13
     *
14
     * @see http://docs.decision-api.acquia.com/#decide_post
15
     *
16
     * @param \Acquia\LiftClient\Entity\Decide $decide
17
     *
18
     * @throws \GuzzleHttp\Exception\RequestException
19
     *
20
     * @return \Acquia\LiftClient\Entity\DecideResponse
21
     */
22
    public function decide(Decide $decide)
23
    {
24
        $body = $decide->json();
25
        $url = '/capture';
26
        $request = new Request('POST', $url, [], $body);
27
        $data = $this->client->getResponseJson($request);
28
29
        return new DecideResponse($data);
30
    }
31
}
32