StatSerps   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A show() 0 13 1
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
     * @param $keywordID
13
     * @param Carbon $date
14
     * @param string $engine
15
     * @return Collection
16
     */
17
    public function show($keywordID, Carbon $date, $engine = 'google'): Collection
18
    {
19
        $response = $this->performQuery('serps/show', ['keyword_id' => $keywordID, 'engine' => $engine, 'date' => $date->toDateString()]);
20
21
        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...
22
            return new StatSerpItem([
23
                'result_type' => $ranking['ResultType'],
24
                'rank' => $ranking['Rank'],
25
                'base_rank' => $ranking['BaseRank'],
26
                'url' => $ranking['Url'],
27
            ]);
28
        });
29
    }
30
}
31