Code Duplication    Length = 54-54 lines in 2 locations

src/Result/InterestOverTimeCollection.php 1 location

@@ 10-63 (lines=54) @@
7
/**
8
 * @author Gabriel Felipe Soares <[email protected]>
9
 */
10
class InterestOverTimeCollection implements JsonSerializable
11
{
12
    /**
13
     * @var string
14
     */
15
    private $searchUrl;
16
17
    /**
18
     * @var InterestOverTimeResult[]
19
     */
20
    private $results;
21
22
    /**
23
     * @var int
24
     */
25
    private $totalResults;
26
27
    public function __construct(string $searchUrl, InterestOverTimeResult ...$terms)
28
    {
29
        $this->searchUrl = $searchUrl;
30
        $this->results = $terms;
31
        $this->totalResults = count($terms);
32
    }
33
34
    public function getSearchUrl(): string
35
    {
36
        return $this->searchUrl;
37
    }
38
39
    /**
40
     * @return InterestOverTimeResult[]
41
     */
42
    public function getResults(): array
43
    {
44
        return $this->results;
45
    }
46
47
    public function getTotalResults(): int
48
    {
49
        return $this->totalResults;
50
    }
51
52
    /**
53
     * @inheritDoc
54
     */
55
    public function jsonSerialize(): array
56
    {
57
        return [
58
            'searchUrl' => $this->getSearchUrl(),
59
            'totalResults' => $this->getTotalResults(),
60
            'results' => $this->getResults(),
61
        ];
62
    }
63
}
64

src/Result/RelatedResultCollection.php 1 location

@@ 10-63 (lines=54) @@
7
/**
8
 * @author Gabriel Felipe Soares <[email protected]>
9
 */
10
class RelatedResultCollection implements JsonSerializable
11
{
12
    /**
13
     * @var string
14
     */
15
    private $searchUrl;
16
17
    /**
18
     * @var RelatedResult[]
19
     */
20
    private $results;
21
22
    /**
23
     * @var int
24
     */
25
    private $totalResults;
26
27
    public function __construct(string $searchUrl, RelatedResult ...$terms)
28
    {
29
        $this->searchUrl = $searchUrl;
30
        $this->results = $terms;
31
        $this->totalResults = count($terms);
32
    }
33
34
    public function getSearchUrl(): string
35
    {
36
        return $this->searchUrl;
37
    }
38
39
    /**
40
     * @return RelatedResult[]
41
     */
42
    public function getResults(): array
43
    {
44
        return $this->results;
45
    }
46
47
    public function getTotalResults(): int
48
    {
49
        return $this->totalResults;
50
    }
51
52
    /**
53
     * @inheritDoc
54
     */
55
    public function jsonSerialize(): array
56
    {
57
        return [
58
            'searchUrl' => $this->getSearchUrl(),
59
            'totalResults' => $this->getTotalResults(),
60
            'results' => $this->getResults(),
61
        ];
62
    }
63
}
64