Passed
Push — master ( cec139...efb60b )
by Maxime
02:27
created

Details::placeId()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
/**
6
 * This file is part of PHP Nominatim.
7
 * (c) Maxime Hélias <[email protected]>
8
 * This source file is subject to the MIT license that is bundled
9
 * with this source code in the file LICENSE.
10
 */
11
12
namespace maxh\Nominatim;
13
14
/**
15
 * Lookup details about a single place by id.
16
 *
17
 * @see http://wiki.openstreetmap.org/wiki/Nominatim
18
 */
19
class Details extends Query
20
{
21
    /**
22
     * Constructor.
23
     *
24
     * @param array $query Default value for this query
25
     */
26
    public function __construct(array &$query = [])
27
    {
28
        parent::__construct($query);
29
30
        $this->setPath('details');
31
32
        $this->acceptedFormat[] = 'html';
33
        $this->acceptedFormat[] = 'jsonv2';
34
    }
35
36
    /**
37
     * Place information by placeId.
38
     *
39
     * @return Details
40
     */
41
    public function placeId(int $placeId): self
42
    {
43
        $this->query['place_id'] = $placeId;
44
45
        return $this;
46
    }
47
48
    /**
49
     * Place information by osmtype and osmid.
50
     *
51
     * @return Details
52
     */
53
    public function osmId(string $osmType, int $osmId): self
54
    {
55
        $this->query['osmtype'] = $osmType;
56
        $this->query['osmid'] = $osmId;
57
58
        return $this;
59
    }
60
}
61