GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 2199a0...d3aed5 )
by Cees-Jan
09:41
created

EmojisHandler::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 5
rs 9.4285
c 1
b 0
f 0
cc 1
eloc 3
nc 1
nop 2
1
<?php declare(strict_types=1);
2
3
namespace ApiClients\Client\Github\CommandBus\Handler;
4
5
use ApiClients\Client\Github\CommandBus\Command\EmojisCommand;
6
use ApiClients\Client\Github\Resource\EmojiInterface;
7
use ApiClients\Client\Github\Service\IteratePagesService;
8
use ApiClients\Foundation\Hydrator\Hydrator;
9
use React\Promise\PromiseInterface;
10
use Rx\Observable;
11
use function React\Promise\resolve;
12
13
final class EmojisHandler
14
{
15
    /**
16
     * @var IteratePagesService
17
     */
18
    private $service;
19
20
    /**
21
     * @var Hydrator
22
     */
23
    private $hydrator;
24
25
    /**
26
     * @param IteratePagesService $service
27
     * @param Hydrator $hydrator
28
     */
29
    public function __construct(IteratePagesService $service, Hydrator $hydrator)
30
    {
31
        $this->service = $service;
32
        $this->hydrator = $hydrator;
33
    }
34
35
    /**
36
     * @param EmojisCommand $command
37
     * @return PromiseInterface
38
     */
39
    public function handle(EmojisCommand $command): PromiseInterface
0 ignored issues
show
Unused Code introduced by
The parameter $command 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...
40
    {
41
        return resolve(
42
            $this->service->iterate('emojis')
43
                ->flatMap(function ($emojis) {
44
                    $structuredEmojis = [];
45
46
                    foreach ($emojis as $name => $image) {
47
                        $structuredEmojis[] = [
48
                            'name' => $name,
49
                            'image' => $image,
50
                        ];
51
                    }
52
53
                    return Observable::fromArray($structuredEmojis);
54
                })->map(function ($emoji) {
55
                    return $this->hydrator->hydrate(EmojiInterface::HYDRATE_CLASS, $emoji);
56
                })
57
        );
58
    }
59
}
60