Completed
Push — master ( ae6a92...7b43ed )
by Frank
01:13
created

becauseTheEventDispatcherDoesNotAcceptListeners()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 9.9332
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace League\Event;
6
7
use LogicException;
8
use Psr\EventDispatcher\EventDispatcherInterface;
9
use Psr\EventDispatcher\ListenerProviderInterface;
10
11
class UnableToSubscribeListener extends LogicException
12
{
13
    public static function becauseTheListenerProviderDoesNotAcceptListeners(
14
        ListenerProviderInterface $configuredListenerProvider
15
    ): UnableToSubscribeListener {
16
        $providerClass = get_class($configuredListenerProvider);
17
18
        return new UnableToSubscribeListener(
19
            "Unable to add listener because the configured listener provider {$providerClass} is not an instance of "
20
            . ListenerAcceptor::class
21
        );
22
    }
23
    public static function becauseTheEventDispatcherDoesNotAcceptListeners(
24
        EventDispatcherInterface $configuredListenerProvider
25
    ): UnableToSubscribeListener {
26
        $providerClass = get_class($configuredListenerProvider);
27
28
        return new UnableToSubscribeListener(
29
            "Unable to add listener because the internal dispatcher {$providerClass} is not an instance of "
30
            . ListenerAcceptor::class
31
        );
32
    }
33
}
34