Completed
Push — master ( 6bb649...990b24 )
by Luca
04:42
created

RoleModel::getRolesListByName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %

Importance

Changes 0
Metric Value
dl 4
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
/**
3
 * This Driver is based entirely on official documentation of the Mattermost Web
4
 * Services API and you can extend it by following the directives of the documentation.
5
 *
6
 * God bless this mess.
7
 *
8
 * @author Luca Agnello <[email protected]>
9
 * @link https://api.mattermost.com/
10
 */
11
12
namespace Gnello\Mattermost\Models;
13
14
/**
15
 * Class RoleModel
16
 *
17
 * @package Gnello\Mattermost\Models
18
 */
19 View Code Duplication
class RoleModel extends AbstractModel
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...
20
{
21
    /**
22
     * @var string
23
     */
24
    private static $endpoint = '/roles';
25
26
    /**
27
     * @param $roleId
28
     * @return \Psr\Http\Message\ResponseInterface
29
     */
30
    public function getRoleByRoleId($roleId)
31
    {
32
        return $this->client->get(self::$endpoint . '/' . $roleId);
33
    }
34
35
    /**
36
     * @param $roleName
37
     * @return \Psr\Http\Message\ResponseInterface
38
     */
39
    public function getRoleByRoleName($roleName)
40
    {
41
        return $this->client->get(self::$endpoint . '/name/' . $roleName);
42
    }
43
44
    /**
45
     * @param       $roleId
46
     * @param array $requestOptions
47
     * @return \Psr\Http\Message\ResponseInterface
48
     */
49
    public function patchRole($roleId, array $requestOptions)
50
    {
51
        return $this->client->put(self::$endpoint . '/roles/' . $roleId . '/patch', $requestOptions);
52
    }
53
54
    /**
55
     * @param array $requestOptions
56
     * @return \Psr\Http\Message\ResponseInterface
57
     */
58
    public function getRolesListByName(array $requestOptions)
59
    {
60
        return $this->client->post(self::$endpoint . '/names', $requestOptions);
61
    }
62
}
63