Completed
Push — master ( 673385...35aecc )
by Luca
02:14
created

SchemeModel::getChannelsOfScheme()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 4
Ratio 100 %

Importance

Changes 0
Metric Value
dl 4
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
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 SchemeModel
16
 *
17
 * @package Gnello\Mattermost\Models
18
 */
19 View Code Duplication
class SchemeModel 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 = '/schemes';
25
26
    /**
27
     * @return \Psr\Http\Message\ResponseInterface
28
     */
29
    public function getSchemes()
30
    {
31
        return $this->client->get(self::$endpoint);
32
    }
33
34
    /**
35
     * @param array $requestOptions
36
     * @return \Psr\Http\Message\ResponseInterface
37
     */
38
    public function createScheme(array $requestOptions)
39
    {
40
        return $this->client->post(self::$endpoint, $requestOptions);
41
    }
42
43
    /**
44
     * @param $schemeId
45
     * @return \Psr\Http\Message\ResponseInterface
46
     */
47
    public function getScheme($schemeId)
48
    {
49
        return $this->client->get(self::$endpoint . '/' . $schemeId);
50
    }
51
52
    /**
53
     * @param $schemeId
54
     * @return \Psr\Http\Message\ResponseInterface
55
     */
56
    public function deleteScheme($schemeId)
57
    {
58
        return $this->client->delete(self::$endpoint . '/' . $schemeId);
59
    }
60
61
    /**
62
     * @param       $schemeId
63
     * @param array $requestOptions
64
     * @return \Psr\Http\Message\ResponseInterface
65
     */
66
    public function patchScheme($schemeId, array $requestOptions)
67
    {
68
        return $this->client->put(self::$endpoint . '/' . $schemeId . '/patch', $requestOptions);
69
    }
70
71
    /**
72
     * @param       $schemeId
73
     * @param array $requestOptions
74
     * @return \Psr\Http\Message\ResponseInterface
75
     */
76
    public function getTeamsOfScheme($schemeId, array $requestOptions)
77
    {
78
        return $this->client->get(self::$endpoint . '/' . $schemeId . '/teams', $requestOptions);
79
    }
80
81
    /**
82
     * @param       $schemeId
83
     * @param array $requestOptions
84
     * @return \Psr\Http\Message\ResponseInterface
85
     */
86
    public function getChannelsOfScheme($schemeId, array $requestOptions)
87
    {
88
        return $this->client->get(self::$endpoint . '/' . $schemeId . '/channels', $requestOptions);
89
    }
90
}
91