Passed
Pull Request — master (#26)
by
unknown
01:39
created

InterestByCityResult::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 15

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 15
ccs 0
cts 15
cp 0
rs 9.7666
c 0
b 0
f 0
cc 1
nc 1
nop 6
crap 2
1
<?php declare(strict_types=1);
2
3
namespace GSoares\GoogleTrends\Result;
4
5
use JsonSerializable;
6
7
/**
8
 * @author Gabriel Felipe Soares <[email protected]>
9
 */
10
class InterestByCityResult implements JsonSerializable
11
{
12
    /**
13
     * @var string
14
     */
15
    private $geoName;
16
17
    /**
18
     * @var int
19
     */
20
    private $value;
21
22
    /**
23
     * @var int
24
     */
25
    private $maxValueIndex;
26
27
    /**
28
     * @var bool
29
     */
30
    private $hasData;
31
32
    public function __construct(
33
        string $geoName,
34
        int $value,
35
        int $maxValueIndex,
36
        bool $hasData,
37
        string $lat,
38
        string $lng
39
    ) {
40
        $this->geoName = $geoName;
41
        $this->value = $value;
42
        $this->maxValueIndex = $maxValueIndex;
43
        $this->hasData = $hasData;
44
        $this->lat = $lat;
45
        $this->lng = $lng;
46
    }
47
48
    public function getGeoName(): string
49
    {
50
        return $this->geoName;
51
    }
52
53
    public function getValue(): int
54
    {
55
        return $this->value;
56
    }
57
58
    public function getMaxValueIndex(): int
59
    {
60
        return $this->maxValueIndex;
61
    }
62
63
    public function hasData(): bool
64
    {
65
        return $this->hasData;
66
    }
67
    
68
    public function getLat(): string
69
    {
70
        return $this->lat;
71
    }
72
    
73
    public function getLng(): string
74
    {
75
        return $this->lng;
76
    }
77
78
    /**
79
     * @inheritDoc
80
     */
81 View Code Duplication
    public function jsonSerialize(): array
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
82
    {
83
        return [
84
            'geoName' => $this->getGeoName(),
85
            'value' => $this->getValue(),
86
            'maxValueIndex' => $this->getMaxValueIndex(),
87
            'hasData' => $this->hasData(),
88
            'lat' => $this->getLat(),
89
            'lng' => $this->getLng()
90
        ];
91
    }
92
}
93