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

Cities::create()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

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