Subversion-Projekte lars-tiefland.laravel_shop

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
148 lars 1
<?php
2
 
3
/*
4
 * This file is part of the Symfony package.
5
 *
6
 * (c) Fabien Potencier <fabien@symfony.com>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
 
12
namespace Symfony\Component\EventDispatcher;
13
 
14
/**
15
 * A read-only proxy for an event dispatcher.
16
 *
17
 * @author Bernhard Schussek <bschussek@gmail.com>
18
 */
19
class ImmutableEventDispatcher implements EventDispatcherInterface
20
{
21
    private EventDispatcherInterface $dispatcher;
22
 
23
    public function __construct(EventDispatcherInterface $dispatcher)
24
    {
25
        $this->dispatcher = $dispatcher;
26
    }
27
 
28
    public function dispatch(object $event, string $eventName = null): object
29
    {
30
        return $this->dispatcher->dispatch($event, $eventName);
31
    }
32
 
33
    public function addListener(string $eventName, callable|array $listener, int $priority = 0)
34
    {
35
        throw new \BadMethodCallException('Unmodifiable event dispatchers must not be modified.');
36
    }
37
 
38
    public function addSubscriber(EventSubscriberInterface $subscriber)
39
    {
40
        throw new \BadMethodCallException('Unmodifiable event dispatchers must not be modified.');
41
    }
42
 
43
    public function removeListener(string $eventName, callable|array $listener)
44
    {
45
        throw new \BadMethodCallException('Unmodifiable event dispatchers must not be modified.');
46
    }
47
 
48
    public function removeSubscriber(EventSubscriberInterface $subscriber)
49
    {
50
        throw new \BadMethodCallException('Unmodifiable event dispatchers must not be modified.');
51
    }
52
 
53
    public function getListeners(string $eventName = null): array
54
    {
55
        return $this->dispatcher->getListeners($eventName);
56
    }
57
 
58
    public function getListenerPriority(string $eventName, callable|array $listener): ?int
59
    {
60
        return $this->dispatcher->getListenerPriority($eventName, $listener);
61
    }
62
 
63
    public function hasListeners(string $eventName = null): bool
64
    {
65
        return $this->dispatcher->hasListeners($eventName);
66
    }
67
}