Passed
Branch develop (2fd4b5)
by Alexey
01:46
created

SuggestScraper   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 13
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 6 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Nelexa\GPlay\Scraper;
5
6
use Nelexa\GPlay\Http\ResponseHandlerInterface;
7
use Psr\Http\Message\RequestInterface;
8
use Psr\Http\Message\ResponseInterface;
9
10
/**
11
 * @internal
12
 */
13
class SuggestScraper implements ResponseHandlerInterface
14
{
15
    /**
16
     * @param RequestInterface $request
17
     * @param ResponseInterface $response
18
     * @return mixed
19
     */
20 1
    public function __invoke(RequestInterface $request, ResponseInterface $response)
21
    {
22 1
        $json = \GuzzleHttp\json_decode($response->getBody()->getContents(), true);
23
        return array_map(static function (array $v) {
24 1
            return $v['s'];
25 1
        }, $json);
26
    }
27
}
28