CityIds   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 38
c 0
b 0
f 0
wmc 4
lcom 1
cbo 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getGetParameterValue() 0 9 2
A getGetParameterName() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Marek\OpenWeatherMap\API\Value\Parameter\Input;
6
7
use Marek\OpenWeatherMap\API\Value\Parameter\GetParameterInterface;
8
9
class CityIds implements GetParameterInterface
10
{
11
    /**
12
     * @var CityId[]
13
     */
14
    protected $cityIds;
15
16
    /**
17
     * CityIds constructor.
18
     *
19
     * @param CityId[] $cityIds
20
     */
21
    public function __construct(array $cityIds = [])
22
    {
23
        $this->cityIds = $cityIds;
24
    }
25
26
    /**
27
     * {@inheritdoc}
28
     */
29
    public function getGetParameterValue(): string
30
    {
31
        $values = [];
32
        foreach ($this->cityIds as $cityId) {
33
            $values[] = $cityId->getCityId();
34
        }
35
36
        return implode(',', $values);
37
    }
38
39
    /**
40
     * {@inheritdoc}
41
     */
42
    public function getGetParameterName(): string
43
    {
44
        return 'id';
45
    }
46
}
47