ChargebackService::create()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 8
Ratio 100 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
dl 8
loc 8
ccs 5
cts 5
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 5
nc 1
nop 1
crap 1
1
<?php
2
3
namespace WSW\SiftScience\Services;
4
5
use WSW\SiftScience\Events\Chargeback;
6
use WSW\SiftScience\Support\Traits\Transformers\Fractal;
7
use WSW\SiftScience\Transformers\Events\ChargebackTransformer;
8
9
/**
10
 * Class ChargebackService
11
 *
12
 * @package WSW\SiftScience\Services
13
 * @author Ronaldo Matos Rodrigues <[email protected]>
14
 */
15 View Code Duplication
class ChargebackService extends BaseService
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...
16
{
17
    use Fractal;
18
19
    /**
20
     * @return Chargeback
21
     */
22 1
    public function createChargebackBuilder()
23
    {
24 1
        return new Chargeback();
25
    }
26
27
    /**
28
     * @param Chargeback $event
29
     *
30
     * @return bool
31
     */
32 2
    public function create(Chargeback $event)
33
    {
34 2
        $event->setApiKey($this->credentials->getApiKey());
35 2
        $body = $this->loadItem($event, new ChargebackTransformer)->toJson();
36 2
        $this->post(static::ENDPOINT, $body);
37
38 1
        return true;
39
    }
40
}
41