Completed
Push — master ( ff5b0d...faa513 )
by Tobias
05:10 queued 02:50
created

UserManagement::show()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 8
Ratio 100 %

Importance

Changes 0
Metric Value
dl 8
loc 8
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 1
1
<?php
2
3
namespace Happyr\ApiClient\Api;
4
5
use Happyr\ApiClient\Assert;
6
use Happyr\ApiClient\Exception;
7
use Happyr\ApiClient\Model\UserManagement\User;
8
use Psr\Http\Message\ResponseInterface;
9
10
/**
11
 * @author Tobias Nyholm <[email protected]>
12
 */
13
final class UserManagement extends HttpApi
14
{
15
    /**
16
     * @param string $user
17
     *
18
     * @return User|ResponseInterface
19
     *
20
     * @throws Exception
21
     */
22 View Code Duplication
    public function show($user)
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...
23
    {
24
        Assert::stringNotEmpty($user);
25
26
        $response = $this->httpGet('/api/user/info', ['user' => $user]);
27
28
        return $this->hydrateResponse($response, User::class);
29
    }
30
31
    /**
32
     * @param string $user
33
     * @param array  $param Valid keys are email, name, gender, birthday, country
34
     *
35
     * @return User|ResponseInterface
36
     *
37
     * @throws Exception
38
     */
39 View Code Duplication
    public function update($user, $param)
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...
40
    {
41
        Assert::stringNotEmpty($user);
42
        $param['user'] = $user;
43
44
        $response = $this->httpPost('/api/user/update/profile', $param);
45
46
        return $this->hydrateResponse($response, User::class);
47
    }
48
}
49