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 ( 0d08ce...5e5f9f )
by Cees-Jan
05:15
created

MyOrganizationsHandler::handle()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 7

Duplication

Lines 11
Ratio 100 %

Code Coverage

Tests 7
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 11
loc 11
ccs 7
cts 7
cp 1
rs 9.4285
c 1
b 0
f 0
cc 1
eloc 7
nc 1
nop 1
crap 1
1
<?php declare(strict_types=1);
2
3
namespace ApiClients\Client\Github\CommandBus\Handler;
4
5
use ApiClients\Client\Github\CommandBus\Command\MyOrganizationsCommand;
6
use ApiClients\Client\Github\Resource\OrganizationInterface;
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 ApiClients\Tools\Rx\unwrapObservableFromPromise;
12
use function React\Promise\resolve;
13
use function WyriHaximus\React\futureFunctionPromise;
14
15 View Code Duplication
final class MyOrganizationsHandler
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
16
{
17
    /**
18
     * @var IteratePagesService
19
     */
20
    private $service;
21
22
    /**
23
     * @var Hydrator
24
     */
25
    private $hydrator;
26
27
    /**
28
     * @param IteratePagesService $service
29
     * @param Hydrator $hydrator
30
     */
31 1
    public function __construct(IteratePagesService $service, Hydrator $hydrator)
32
    {
33 1
        $this->service = $service;
34 1
        $this->hydrator = $hydrator;
35 1
    }
36
37
    /**
38
     * @param MyOrganizationsCommand $command
39
     * @return PromiseInterface
40
     */
41 1
    public function handle(MyOrganizationsCommand $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...
42
    {
43 1
        return resolve(
44 1
            $this->service->iterate('user/orgs')
45
                ->flatMap(function ($organizations) {
46 1
                    return Observable::fromArray($organizations);
47 1
                })->map(function ($organization) {
48 1
                    return $this->hydrator->hydrate(OrganizationInterface::HYDRATE_CLASS, $organization);
49 1
                })
50
        );
51
    }
52
}
53