Services   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 55
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 12
dl 0
loc 55
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A create() 0 8 1
A getTypes() 0 7 1
A update() 0 8 1
1
<?php
2
3
namespace Uon\Endpoints;
4
5
use Uon\Client;
6
7
/**
8
 * Class Services
9
 *
10
 * @package Uon\Endpoint
11
 */
12
class Services extends Client
13
{
14
    /**
15
     * Add service to voucher
16
     *
17
     * @link https://api.u-on.ru/{key}/request-action/create.{_format}
18
     *
19
     * @param array $parameters List of parameters
20
     *
21
     * @return null|object|\Uon\Interfaces\ClientInterface
22
     */
23
    public function create(array $parameters)
24
    {
25
        // Set HTTP params
26
        $this->type     = 'post';
27
        $this->endpoint = 'service/create';
28
        $this->params   = $parameters;
29
30
        return $this->done();
31
    }
32
33
    /**
34
     * Get a list of service types for voucher
35
     *
36
     * @link https://api.u-on.ru/{key}/service_type.{_format}
37
     *
38
     * @return null|object|\Uon\Interfaces\ClientInterface
39
     */
40
    public function getTypes()
41
    {
42
        // Set HTTP params
43
        $this->type     = 'get';
44
        $this->endpoint = 'service_type';
45
46
        return $this->done();
47
    }
48
49
    /**
50
     * Update service by ID
51
     *
52
     * @link https://api.u-on.ru/{key}/service/update/{id}.{_format}
53
     *
54
     * @param int   $id         Unique ID of service
55
     * @param array $parameters List of parameters
56
     *
57
     * @return null|object|\Uon\Interfaces\ClientInterface
58
     */
59
    public function update(int $id, array $parameters)
60
    {
61
        // Set HTTP params
62
        $this->type     = 'post';
63
        $this->endpoint = 'service/update/' . $id;
64
        $this->params   = $parameters;
65
66
        return $this->done();
67
    }
68
}
69