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.

Code Duplication    Length = 45-51 lines in 3 locations

src/CommandBus/Handler/Organization/AddWebHookHandler.php 1 location

@@ 13-57 (lines=45) @@
10
use React\Promise\PromiseInterface;
11
use RingCentral\Psr7\Request;
12
13
final class AddWebHookHandler
14
{
15
    /**
16
     * @var RequestService
17
     */
18
    private $requestService;
19
20
    /**
21
     * @var Hydrator
22
     */
23
    private $hydrator;
24
25
    /**
26
     * @param RequestService $requestService
27
     * @param Hydrator       $hydrator
28
     */
29
    public function __construct(RequestService $requestService, Hydrator $hydrator)
30
    {
31
        $this->requestService = $requestService;
32
        $this->hydrator = $hydrator;
33
    }
34
35
    /**
36
     * @param  AddWebHookCommand $command
37
     * @return PromiseInterface
38
     */
39
    public function handle(AddWebHookCommand $command): PromiseInterface
40
    {
41
        return $this->requestService->request(
42
            new Request(
43
                'POST',
44
                'orgs/' . $command->getOrganization() . '/hooks',
45
                [],
46
                new JsonStream([
47
                    'name'   => $command->getName(),
48
                    'config' => $command->getConfig(),
49
                    'events' => $command->getEvents(),
50
                    'active' => $command->isActive(),
51
                ])
52
            )
53
        )->then(function ($hook) {
54
            return $this->hydrator->hydrate(WebHookInterface::HYDRATE_CLASS, $hook->getBody()->getParsedContents());
55
        });
56
    }
57
}
58

src/CommandBus/Handler/Repository/AddWebHookHandler.php 1 location

@@ 13-57 (lines=45) @@
10
use React\Promise\PromiseInterface;
11
use RingCentral\Psr7\Request;
12
13
final class AddWebHookHandler
14
{
15
    /**
16
     * @var RequestService
17
     */
18
    private $requestService;
19
20
    /**
21
     * @var Hydrator
22
     */
23
    private $hydrator;
24
25
    /**
26
     * @param RequestService $requestService
27
     * @param Hydrator       $hydrator
28
     */
29
    public function __construct(RequestService $requestService, Hydrator $hydrator)
30
    {
31
        $this->requestService = $requestService;
32
        $this->hydrator = $hydrator;
33
    }
34
35
    /**
36
     * @param  AddWebHookCommand $command
37
     * @return PromiseInterface
38
     */
39
    public function handle(AddWebHookCommand $command): PromiseInterface
40
    {
41
        return $this->requestService->request(
42
            new Request(
43
                'POST',
44
                'repos/' . $command->getRepository() . '/hooks',
45
                [],
46
                new JsonStream([
47
                    'name'   => $command->getName(),
48
                    'config' => $command->getConfig(),
49
                    'events' => $command->getEvents(),
50
                    'active' => $command->isActive(),
51
                ])
52
            )
53
        )->then(function ($hook) {
54
            return $this->hydrator->hydrate(WebHookInterface::HYDRATE_CLASS, $hook->getBody()->getParsedContents());
55
        });
56
    }
57
}
58

src/CommandBus/Handler/Repository/CommitHandler.php 1 location

@@ 14-64 (lines=51) @@
11
use React\Promise\PromiseInterface;
12
use RingCentral\Psr7\Request;
13
14
final class CommitHandler
15
{
16
    /**
17
     * @var RequestService
18
     */
19
    private $requestService;
20
21
    /**
22
     * @var Hydrator
23
     */
24
    private $hydrator;
25
26
    /**
27
     * @var LoopInterface
28
     */
29
    private $loop;
30
31
    /**
32
     * @param RequestService $requestService
33
     * @param Hydrator       $hydrator
34
     * @param LoopInterface  $loop
35
     */
36
    public function __construct(RequestService $requestService, Hydrator $hydrator, LoopInterface $loop)
37
    {
38
        $this->requestService = $requestService;
39
        $this->hydrator = $hydrator;
40
        $this->loop = $loop;
41
    }
42
43
    /**
44
     * @param  CommitCommand    $command
45
     * @return PromiseInterface
46
     */
47
    public function handle(CommitCommand $command): PromiseInterface
48
    {
49
        return $this->requestService->request(
50
            new Request(
51
                'POST',
52
                'repos/' . $command->getRepository() . '/git/commits',
53
                [],
54
                new JsonStream([
55
                    'message' => $command->getMessage(),
56
                    'tree' => $command->getTree(),
57
                    'parents' => $command->getCommit(),
58
                ])
59
            )
60
        )->then(function ($tree) {
61
            return $this->hydrator->hydrate(CommitInterface::HYDRATE_CLASS, $tree->getBody()->getParsedContents());
62
        });
63
    }
64
}
65