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.

EmojisHandler   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 3
dl 0
loc 47
c 0
b 0
f 0
ccs 16
cts 16
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A handle() 0 20 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 function ApiClients\Tools\Rx\observableFromArray;
10
use React\Promise\PromiseInterface;
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 1
    public function __construct(IteratePagesService $service, Hydrator $hydrator)
30
    {
31 1
        $this->service = $service;
32 1
        $this->hydrator = $hydrator;
33 1
    }
34
35
    /**
36
     * @param  EmojisCommand    $command
37
     * @return PromiseInterface
38
     */
39 1
    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 1
        return resolve(
42 1
            $this->service->iterate('emojis')
43 1
                ->flatMap(function ($emojis) {
44 1
                    $structuredEmojis = [];
45
46 1
                    foreach ($emojis as $name => $image) {
47 1
                        $structuredEmojis[] = [
48 1
                            'name' => $name,
49 1
                            'image' => $image,
50
                        ];
51
                    }
52
53 1
                    return observableFromArray($structuredEmojis);
54
                })->map(function ($emoji) {
55 1
                    return $this->hydrator->hydrate(EmojiInterface::HYDRATE_CLASS, $emoji);
56 1
                })
57
        );
58
    }
59
}
60