CreateAccountService::createAccountBuilder()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %

Code Coverage

Tests 2
CRAP Score 1

Importance

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