Api   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 34
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A getCity() 0 5 1
1
<?php
2
/**
3
 * TERYT-API
4
 *
5
 * Copyright (c) 2019 pudelek.org.pl
6
 *
7
 * @license MIT License (MIT)
8
 *
9
 * For the full copyright and license information, please view source file
10
 * that is bundled with this package in the file LICENSE
11
 * @author Marcin Pudełek <[email protected]>
12
 */
13
14
namespace mrcnpdlk\Teryt;
15
16
use mrcnpdlk\Teryt\Model\City;
17
18
/**
19
 * Class Api
20
 */
21
class Api
22
{
23
    /**
24
     * @var NativeApi
25
     */
26
    private $oNativeApi;
27
28
    /**
29
     * Api constructor.
30
     *
31
     * @param \mrcnpdlk\Teryt\Config $configuration
32
     */
33 2
    public function __construct(Config $configuration)
34
    {
35 2
        $this->oNativeApi = NativeApi::create($configuration);
36 2
    }
37
38
    /**
39
     * Get information about City
40
     *
41
     * @param string $id
42
     *
43
     * @throws \mrcnpdlk\Teryt\Exception
44
     * @throws \mrcnpdlk\Teryt\Exception\Connection
45
     * @throws \mrcnpdlk\Teryt\Exception\InvalidArgument
46
     * @throws \mrcnpdlk\Teryt\Exception\NotFound
47
     *
48
     * @return City
49
     */
50 2
    public function getCity(string $id): City
51
    {
52 2
        $oCity = new City();
53
54 2
        return $oCity->find($id);
55
    }
56
}
57