Completed
Push — master ( 45165d...5e44c4 )
by Alexey
04:08 queued 11s
created

SuggestScraper   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
eloc 6
c 1
b 0
f 0
dl 0
loc 17
ccs 5
cts 5
cp 1
rs 10

1 Method

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