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.

Worker   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Test Coverage

Coverage 93.75%

Importance

Changes 0
Metric Value
eloc 17
dl 0
loc 30
rs 10
c 0
b 0
f 0
ccs 15
cts 16
cp 0.9375
wmc 6

2 Methods

Rating   Name   Duplication   Size   Complexity  
A execute() 0 21 5
A __construct() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
/* (c) Anton Medvedev <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace Deployer\Executor;
12
13
use Deployer\Deployer;
14
use Deployer\Exception\Exception;
15
use Deployer\Exception\GracefulShutdownException;
16
use Deployer\Exception\RunException;
17
use Deployer\Host\Host;
18
use Deployer\Task\Context;
19
use Deployer\Task\Task;
20
use Throwable;
21
22
class Worker
23 8
{
24
    private Deployer $deployer;
25 8
26 8
    public function __construct(Deployer $deployer)
27
    {
28 8
        $this->deployer = $deployer;
29
    }
30
31 8
    public function execute(Task $task, Host $host): int
32
    {
33 8
        try {
34
            Exception::setTaskSourceLocation($task->getSourceLocation());
35 8
36 8
            $context = new Context($host);
37
            $task->run($context);
38 8
39 2
            if ($task->getName() !== 'connect') {
40 2
                $this->deployer->messenger->endOnHost($host);
41 2
            }
42 1
            return 0;
43
        } catch (Throwable $e) {
44 1
            $this->deployer->messenger->renderException($e, $host);
45 1
            if ($e instanceof GracefulShutdownException) {
46
                return GracefulShutdownException::EXIT_CODE;
47
            }
48
            if ($e instanceof RunException) {
49
                return $e->getExitCode();
50
            }
51
            return 255;
52
        }
53
    }
54
}
55