Completed
Push — master ( 97fc71...726d4b )
by WEBEWEB
01:08
created

RegionsResponse::addRegion()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
/*
4
 * This file is part of the geo-api-library package.
5
 *
6
 * (c) 2020 WEBEWEB
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace WBW\Library\GeoAPI\Response;
13
14
use WBW\Library\GeoAPI\Model\Region;
15
16
/**
17
 * Régions response.
18
 *
19
 * @author webeweb <https://github.com/webeweb/>
20
 * @package WBW\Library\GeoAPI\Response
21
 */
22
class RegionsResponse extends AbstractResponse {
23
24
    /**
25
     * Régions.
26
     *
27
     * @var Region[]
28
     */
29
    private $regions;
30
31
    /**
32
     * Constructor.
33
     */
34
    public function __construct() {
35
        $this->setRegions([]);
36
    }
37
38
    /**
39
     * Add a région.
40
     *
41
     * @param Region $region The région.
42
     * @return RegionsResponse Returns this liste région response.
43
     */
44
    public function addRegion(Region $region): RegionsResponse {
45
        $this->regions[] = $region;
46
        return $this;
47
    }
48
49
    /**
50
     * Get the régions.
51
     *
52
     * @return Region[] Returns the régions.
53
     */
54
    public function getRegions(): array {
55
        return $this->regions;
56
    }
57
58
    /**
59
     * Set the régions.
60
     *
61
     * @param Region[] $regions The régions.
62
     * @return RegionsResponse Returns this liste régions response.
63
     */
64
    protected function setRegions(array $regions): RegionsResponse {
65
        $this->regions = $regions;
66
        return $this;
67
    }
68
}