Completed
Push — master ( dd94bd...da08c1 )
by Evan
04:57 queued 02:56
created

ProfileGateway::setPersonal()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 7

Duplication

Lines 11
Ratio 100 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 11
loc 11
ccs 0
cts 10
cp 0
rs 9.4285
cc 1
eloc 7
nc 1
nop 3
crap 2
1
<?php
2
/*
3
 * This file is part of the PayBreak/basket package.
4
 *
5
 * (c) PayBreak <[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
11
namespace PayBreak\Sdk\Gateways;
12
13
use PayBreak\Sdk\Entities\Profile\AddressEntity;
14
use PayBreak\Sdk\Entities\Profile\EmploymentEntity;
15
use PayBreak\Sdk\Entities\Profile\FinancialEntity;
16
use PayBreak\Sdk\Entities\Profile\PersonalEntity;
17
18
/**
19
 * Class ProfileGateway
20
 *
21
 * @author EB
22
 * @package PayBreak\Sdk\Gateways
23
 */
24
class ProfileGateway extends AbstractGateway
25
{
26
    /**
27
     * @author EB
28
     * @param $application
29
     * @param array $personal
30
     * @param $token
31
     * @return array
32
     */
33 View Code Duplication
    public function createPersonal($application, array $personal, $token)
0 ignored issues
show
Duplication introduced by
This method 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...
34
    {
35
        $entity = PersonalEntity::make($personal);
36
37
        return $this->postDocument(
38
            '/v4/applications/' . $application . '/user',
39
            $entity->toArray(),
40
            $token,
41
            'Personal'
42
        );
43
    }
44
45
    /**
46
     * @author EA
47
     * @param int $user
48
     * @param array $personal
49
     * @param $token
50
     * @return array
51
     */
52 View Code Duplication
    public function setPersonal($user, array $personal, $token)
0 ignored issues
show
Duplication introduced by
This method 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...
53
    {
54
        $entity = PersonalEntity::make($personal);
55
56
        return $this->postDocument(
57
            '/v4/users/' . $user . '/personal',
58
            $entity->toArray(),
59
            $token,
60
            'Set Personal'
61
        );
62
    }
63
64
    /**
65
     * @author EB
66
     * @param int $user
67
     * @param array $financial
68
     * @param $token
69
     * @return array
70
     */
71
    public function setFinancial($user, array $financial, $token)
72
    {
73
        $entity = FinancialEntity::make($financial);
74
75
        return $this->postDocument(
76
            '/v4/users/' . $user . '/financial',
77
            $entity->toArray(),
78
            $token,
79
            'Set Financial'
80
        );
81
    }
82
83
    /**
84
     * @author EA
85
     * @param int $user
86
     * @param array $employment
87
     * @param $token
88
     * @return array
89
     */
90
    public function setEmployment($user, array $employment, $token)
91
    {
92
        $entity = EmploymentEntity::make($employment);
93
94
        return $this->postDocument(
95
            '/v4/users/' . $user . '/employment',
96
            $entity->toArray(),
97
            $token,
98
            'Set Employment'
99
        );
100
    }
101
102
    /**
103
     * @author EA
104
     * @param $user
105
     * @param array $address
106
     * @param $token
107
     * @return array
108
     */
109
    public function setAddress($user, array $address, $token)
110
    {
111
        $entity = AddressEntity::make($address);
112
113
        return $this->postDocument(
114
            '/v4/users/' . $user . '/address',
115
            $entity->toArray(),
116
            $token,
117
            'Set Address'
118
        );
119
    }
120
}
121