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 — devel ( df32c1...525bc2 )
by Alex
04:03 queued 28s
created

AutoSubscribeFeature   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 5

Test Coverage

Coverage 46.67%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 5
dl 0
loc 30
ccs 7
cts 15
cp 0.4667
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A describe() 0 10 1
A setup() 0 10 1
1
<?php
2
namespace PSB\Core\Routing\AutoSubscription;
3
4
5
use PSB\Core\Feature\Feature;
6
use PSB\Core\KnownSettingsEnum;
7
use PSB\Core\MessageHandlerRegistry;
8
use PSB\Core\ObjectBuilder\BuilderInterface;
9
use PSB\Core\Pipeline\PipelineModifications;
10
use PSB\Core\Util\Settings;
11
12
class AutoSubscribeFeature extends Feature
13
{
14
15 1
    public function describe()
16
    {
17 1
        $this->enableByDefault();
18 1
        $this->registerPrerequisite(
19 1
            function (Settings $settings) {
20
                return !$settings->tryGet(KnownSettingsEnum::SEND_ONLY);
21 1
            },
22 1
            "Send only endpoints can't autosubscribe."
23
        );
24 1
    }
25
26
    /**
27
     * @param Settings              $settings
28
     * @param BuilderInterface      $builder
29
     * @param PipelineModifications $pipelineModifications
30
     */
31
    public function setup(Settings $settings, BuilderInterface $builder, PipelineModifications $pipelineModifications)
32
    {
33
        $this->registerStartupTask(
34
            function (BuilderInterface $builder) {
35
                /** @var MessageHandlerRegistry $handlerRegistry */
36
                $handlerRegistry = $builder->build(MessageHandlerRegistry::class);
37
                return new SubscriptionApplierStartupTask($handlerRegistry->getEventFqcns());
38
            }
39
        );
40
    }
41
}
42