Completed
Push — master ( ec18ae...5b38d7 )
by Felix
10:07
created

StatSerps::show()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 16
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 16
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 8
nc 1
nop 3
1
<?php
2
3
namespace SchulzeFelix\Stat\Api;
4
5
use Carbon\Carbon;
6
use Illuminate\Support\Collection;
7
use SchulzeFelix\Stat\Objects\StatSerpItem;
8
9
class StatSerps extends BaseStat
10
{
11
12
    /**
13
     * @param $keywordID
14
     * @param Carbon $date
15
     * @param string $engine
16
     * @return Collection
17
     */
18
    public function show($keywordID, Carbon $date, $engine = 'google') : Collection
19
    {
20
        $response = $this->performQuery('serps/show', ['keyword_id' => $keywordID, 'engine' => $engine, 'date' => $date->toDateString()]);
21
22
        return collect($response['Result'])->transform(function ($ranking, $key) {
0 ignored issues
show
Unused Code introduced by
The parameter $key is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
23
24
            return new StatSerpItem([
25
                'result_type' => $ranking['ResultType'],
26
                'rank' => $ranking['Rank'],
27
                'base_rank' => $ranking['BaseRank'],
28
                'url' => $ranking['Url'],
29
            ]);
30
31
        });
32
33
    }
34
35
36
37
38
39
}
40