Passed
Push — master ( f86309...3fa716 )
by Mr
01:59 queued 22s
created

Countries   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 39
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A create() 0 4 1
A all() 0 4 1
A update() 0 4 1
1
<?php
2
3
namespace UON\Endpoint;
4
5
use UON\Client;
6
7
/**
8
 * Class Countries
9
 * @package UON
10
 */
11
class Countries extends Client
12
{
13
    /**
14
     * Create new country
15
     *
16
     * @link    https://api.u-on.ru/{key}/country/create.{_format}
17
     * @param   array $parameters - List of parameters
18
     * @return  array|false
19
     */
20
    public function create(array $parameters)
21
    {
22
        $endpoint = '/country/create';
23
        return $this->doRequest('post', $endpoint, $parameters);
24
    }
25
26
    /**
27
     * Get all countries
28
     *
29
     * @link    https://api.u-on.ru/{key}/countries.{_format}
30
     * @return  array|false
31
     */
32
    public function all()
33
    {
34
        $endpoint = '/countries';
35
        return $this->doRequest('get', $endpoint);
36
    }
37
38
    /**
39
     * Update country by ID
40
     *
41
     * @link    https://api.u-on.ru/{key}/country/update/{id}.{_format}
42
     * @param   int $id - Unique country ID
43
     * @param   array $parameters - List of parameters
44
     * @return  array|false
45
     */
46
    public function update($id, array $parameters)
47
    {
48
        $endpoint = '/country/update/' . $id;
49
        return $this->doRequest('post', $endpoint, $parameters);
50
    }
51
52
}
53